Skip to content

Commit

Permalink
released 7.0.3
Browse files Browse the repository at this point in the history
fix #435 & fix #436 problems with the TUI on Windows with ConEmu
  • Loading branch information
genivia-inc committed Nov 12, 2024
1 parent bddae22 commit 2a0d884
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 73 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4763,7 +4763,8 @@ in markdown:

--tabs[=NUM]
Set the tab size to NUM to expand tabs for option -k. The value
of NUM may be 1, 2, 4, or 8. The default tab size is 8.
of NUM may be 1 (no expansion), 2, 4, or 8. The default size is
8.

--tag[=TAG[,END]]
Disables colors to mark up matches with TAG. END marks the end of
Expand Down Expand Up @@ -5458,7 +5459,7 @@ in markdown:



ugrep 7.0.2 October 27, 2024 UGREP(1)
ugrep 7.0.3 November 10, 2024 UGREP(1)

🔝 [Back to table of contents](#toc)

Expand Down
Binary file modified bin/win32/ug.exe
Binary file not shown.
Binary file modified bin/win32/ugrep-indexer.exe
Binary file not shown.
Binary file modified bin/win32/ugrep.exe
Binary file not shown.
Binary file modified bin/win64/ug.exe
Binary file not shown.
Binary file modified bin/win64/ugrep-indexer.exe
Binary file not shown.
Binary file modified bin/win64/ugrep.exe
Binary file not shown.
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for ugrep 7.0.2.
# Generated by GNU Autoconf 2.72 for ugrep 7.0.3.
#
# Report bugs to <https://github.com/Genivia/ugrep/issues>.
#
Expand Down Expand Up @@ -606,8 +606,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ugrep'
PACKAGE_TARNAME='ugrep'
PACKAGE_VERSION='7.0.2'
PACKAGE_STRING='ugrep 7.0.2'
PACKAGE_VERSION='7.0.3'
PACKAGE_STRING='ugrep 7.0.3'
PACKAGE_BUGREPORT='https://github.com/Genivia/ugrep/issues'
PACKAGE_URL='https://ugrep.com'

Expand Down Expand Up @@ -1382,7 +1382,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
'configure' configures ugrep 7.0.2 to adapt to many kinds of systems.
'configure' configures ugrep 7.0.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1453,7 +1453,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of ugrep 7.0.2:";;
short | recursive ) echo "Configuration of ugrep 7.0.3:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1630,7 +1630,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
ugrep configure 7.0.2
ugrep configure 7.0.3
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2184,7 +2184,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ugrep $as_me 7.0.2, which was
It was created by ugrep $as_me 7.0.3, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -3694,7 +3694,7 @@ fi

# Define the identity of the package.
PACKAGE='ugrep'
VERSION='7.0.2'
VERSION='7.0.3'


printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
Expand Down Expand Up @@ -11790,7 +11790,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by ugrep $as_me 7.0.2, which was
This file was extended by ugrep $as_me 7.0.3, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -11863,7 +11863,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
ugrep config.status 7.0.2
ugrep config.status 7.0.3
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([ugrep],[7.0.2],[https://github.com/Genivia/ugrep/issues],[ugrep],[https://ugrep.com])
AC_INIT([ugrep],[7.0.3],[https://github.com/Genivia/ugrep/issues],[ugrep],[https://ugrep.com])
AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz no-dist-gzip])
AC_CONFIG_HEADERS([config.h])
AC_COPYRIGHT([Copyright (C) 2019-2024 Robert van Engelen, Genivia Inc.])
Expand Down
6 changes: 0 additions & 6 deletions lib/matcher_avx512bw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,11 @@ void Matcher::simd_init_advance_avx512bw()
}
else if (pat_->bmd_ == 0)
{
#if defined(WITH_STRING_PM)
if (pat_->min_ >= 4)
adv_ = &Matcher::simd_advance_string_pmh_avx512bw;
else if (pat_->min_ > 0)
adv_ = &Matcher::simd_advance_string_pma_avx512bw;
else
#endif
adv_ = &Matcher::simd_advance_string_avx512bw;
}
}
Expand Down Expand Up @@ -271,8 +269,6 @@ bool Matcher::simd_advance_string_avx512bw(size_t loc)
return advance_string(loc);
}

#if defined(WITH_STRING_PM)

/// Implements AVX512BW string search scheme based on http://0x80.pl/articles/simd-friendly-karp-rabin.html
bool Matcher::simd_advance_string_pma_avx512bw(size_t loc)
{
Expand Down Expand Up @@ -367,8 +363,6 @@ bool Matcher::simd_advance_string_pmh_avx512bw(size_t loc)
return advance_string_pmh(loc);
}

#endif // WITH_STRING_PM

#else

// appease ranlib "has no symbols"
Expand Down
4 changes: 2 additions & 2 deletions man/ug.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH UGREP "1" "October 27, 2024" "ugrep 7.0.2" "User Commands"
.TH UGREP "1" "November 10, 2024" "ugrep 7.0.3" "User Commands"
.SH NAME
\fBugrep\fR, \fBug\fR -- file pattern searcher
.SH SYNOPSIS
Expand Down Expand Up @@ -817,7 +817,7 @@ repeated. The possible file types can be (\fB\-t\fRlist displays a list):
.TP
\fB\-\-tabs\fR[=\fINUM\fR]
Set the tab size to NUM to expand tabs for option \fB\-k\fR. The value of
NUM may be 1, 2, 4, or 8. The default tab size is 8.
NUM may be 1 (no expansion), 2, 4, or 8. The default size is 8.
.TP
\fB\-\-tag\fR[=\fITAG\fR[,\fIEND\fR]]
Disables colors to mark up matches with TAG. END marks the end of
Expand Down
2 changes: 1 addition & 1 deletion man/ugrep-indexer.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH UGREP-INDEXER "1" "October 27, 2024" "ugrep-indexer 7.0.2" "User Commands"
.TH UGREP-INDEXER "1" "November 10, 2024" "ugrep-indexer 7.0.3" "User Commands"
.SH NAME
\fBugrep-indexer\fR -- file indexer to accelerate recursive searching
.SH SYNOPSIS
Expand Down
4 changes: 2 additions & 2 deletions man/ugrep.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH UGREP "1" "October 27, 2024" "ugrep 7.0.2" "User Commands"
.TH UGREP "1" "November 10, 2024" "ugrep 7.0.3" "User Commands"
.SH NAME
\fBugrep\fR, \fBug\fR -- file pattern searcher
.SH SYNOPSIS
Expand Down Expand Up @@ -817,7 +817,7 @@ repeated. The possible file types can be (\fB\-t\fRlist displays a list):
.TP
\fB\-\-tabs\fR[=\fINUM\fR]
Set the tab size to NUM to expand tabs for option \fB\-k\fR. The value of
NUM may be 1, 2, 4, or 8. The default tab size is 8.
NUM may be 1 (no expansion), 2, 4, or 8. The default size is 8.
.TP
\fB\-\-tag\fR[=\fITAG\fR[,\fIEND\fR]]
Disables colors to mark up matches with TAG. END marks the end of
Expand Down
33 changes: 30 additions & 3 deletions src/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2429,6 +2429,10 @@ void Query::view()

FILE *pager = NULL;

#ifdef OS_WIN
std::wstring wcommand;
#endif

if (flag_stdin && filename == flag_label)
{
// standard input is viewed via a pipe to the pager
Expand Down Expand Up @@ -2463,12 +2467,35 @@ void Query::view()
}
else
{
// view file in the pager
// view file in the pager using system() call
command.append(" \"").append(filename).append("\"");

#ifdef OS_WIN
// Windows system() does not support non-ASCII, instead we use a wide string with _wsystem()
wcommand = utf8_decode(command);

// flush before calling _wsystem(), according to the Window's system API documentation
_flushall();
#endif
}

// pipe to pager was OK or executing the command is OK
bool ok;

if ((flag_stdin && filename == flag_label) || !partname.empty())
{
ok = (pager != NULL);
}
else
{
#ifdef OS_WIN
ok = (_wsystem(wcommand.c_str()) == 0);
#else
ok = (system(command.c_str()) == 0);
#endif
}

// pipe to pager was OK or execute the command
if ((flag_stdin && filename == flag_label) || !partname.empty() ? pager != NULL : system(command.c_str()) == 0)
if (ok)
{
#ifdef OS_WIN
if (strcmp(flag_view, "more") == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/ugrep-indexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/

// DO NOT ALTER THIS LINE: updated by makemake.sh and we need it physically here for MSVC++ build from source
#define UGREP_VERSION "7.0.2"
#define UGREP_VERSION "7.0.3"

// use a task-parallel thread to decompress the stream into a pipe to search, also handles nested archives
#define WITH_DECOMPRESSION_THREAD
Expand Down
5 changes: 4 additions & 1 deletion src/ugrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7264,6 +7264,9 @@ void init(int argc, const char **argv)
// --filter: Cygwin forked process may hang when searching with multiple threads, force one worker thread
if (!flag_filter.empty())
flag_jobs = 1;
#elif defined(OS_WIN)
if (!flag_filter.empty())
abort("--filter: not supported for ", PLATFORM);
#endif
}

Expand Down Expand Up @@ -14389,7 +14392,7 @@ void help(std::ostream& out)
out << ".\n\
--tabs[=NUM]\n\
Set the tab size to NUM to expand tabs for option -k. The value of\n\
NUM may be 1, 2, 4, or 8. The default tab size is 8.\n\
NUM may be 1 (no expansion), 2, 4, or 8. The default size is 8.\n\
--tag[=TAG[,END]]\n\
Disables colors to mark up matches with TAG. END marks the end of\n\
a match if specified, otherwise TAG. The default is `___'.\n\
Expand Down
2 changes: 1 addition & 1 deletion src/ugrep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define UGREP_HPP

// DO NOT ALTER THIS LINE: updated by makemake.sh and we need it physically here for MSVC++ build from source
#define UGREP_VERSION "7.0.2"
#define UGREP_VERSION "7.0.3"

// disable mmap because mmap is almost always slower than the file reading speed improvements since 3.0.0
#define WITH_NO_MMAP
Expand Down
92 changes: 49 additions & 43 deletions src/vkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,23 @@ int VKey::raw_in(int timeout)
if (keybuf[0])
return rot_keybuf();

switch (WaitForSingleObject(hConIn, timeout))
while (true)
{
case WAIT_OBJECT_0:
if (!_kbhit())
{
switch (WaitForSingleObject(hConIn, timeout))
{
case WAIT_OBJECT_0:
if (_kbhit())
return raw_get();
// discard non-key-press event
FlushConsoleInputBuffer(hConIn);
return 0;
}
return raw_get();
break;

case WAIT_TIMEOUT:
return 0;
case WAIT_TIMEOUT:
return 0;

default:
return EOF;
default:
return EOF;
}
}
}

Expand Down Expand Up @@ -265,25 +267,27 @@ int VKey::raw_in(int timeout)
DWORD nread = 0;
INPUT_RECORD rec;

switch (WaitForSingleObject(hConIn, timeout))
while (true)
{
case WAIT_OBJECT_0:
if (PeekConsoleInputW(hConIn, &rec, 1, &nread) != 0 &&
nread == 1 &&
rec.EventType == KEY_EVENT &&
rec.Event.KeyEvent.bKeyDown)
return raw_get();

// discard event
if (nread == 1)
ReadConsoleInputW(hConIn, &rec, 1, &nread);
return 0;
switch (WaitForSingleObject(hConIn, timeout))
{
case WAIT_OBJECT_0:
if (PeekConsoleInputW(hConIn, &rec, 1, &nread) != 0 &&
nread == 1 &&
rec.EventType == KEY_EVENT &&
rec.Event.KeyEvent.bKeyDown)
return raw_get();
// discard non-key-press event
if (nread == 1)
ReadConsoleInputW(hConIn, &rec, 1, &nread);
break;

case WAIT_TIMEOUT:
return 0;
case WAIT_TIMEOUT:
return 0;

default:
return EOF;
default:
return EOF;
}
}
}

Expand All @@ -293,25 +297,27 @@ bool VKey::poll(int timeout)
DWORD nread = 0;
INPUT_RECORD rec;

switch (WaitForSingleObject(hConIn, timeout))
while (true)
{
case WAIT_OBJECT_0:
if (PeekConsoleInputW(hConIn, &rec, 1, &nread) != 0 &&
nread == 1 &&
rec.EventType == KEY_EVENT &&
rec.Event.KeyEvent.bKeyDown)
return true;

// discard event
if (nread == 1)
ReadConsoleInputW(hConIn, &rec, 1, &nread);
return 0;
switch (WaitForSingleObject(hConIn, timeout))
{
case WAIT_OBJECT_0:
if (PeekConsoleInputW(hConIn, &rec, 1, &nread) != 0 &&
nread == 1 &&
rec.EventType == KEY_EVENT &&
rec.Event.KeyEvent.bKeyDown)
return true;
// discard non-key-press event
if (nread == 1)
ReadConsoleInputW(hConIn, &rec, 1, &nread);
break;

case WAIT_TIMEOUT:
return false;
case WAIT_TIMEOUT:
return false;

default:
return true;
default:
return true;
}
}
}

Expand Down

0 comments on commit 2a0d884

Please sign in to comment.