Skip to content

Commit

Permalink
released 7.0.4
Browse files Browse the repository at this point in the history
fix ugrep.exe TUI issue #438 after #437 which caused some users to struggle with TUI issues due to Windows API peculiarities with different Windows OS
  • Loading branch information
genivia-inc committed Nov 14, 2024
1 parent 765986e commit ffd990f
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5459,7 +5459,7 @@ in markdown:



ugrep 7.0.3 November 10, 2024 UGREP(1)
ugrep 7.0.4 November 12, 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.3.
# Generated by GNU Autoconf 2.72 for ugrep 7.0.4.
#
# 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.3'
PACKAGE_STRING='ugrep 7.0.3'
PACKAGE_VERSION='7.0.4'
PACKAGE_STRING='ugrep 7.0.4'
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.3 to adapt to many kinds of systems.
'configure' configures ugrep 7.0.4 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.3:";;
short | recursive ) echo "Configuration of ugrep 7.0.4:";;
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.3
ugrep configure 7.0.4
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.3, which was
It was created by ugrep $as_me 7.0.4, 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.3'
VERSION='7.0.4'


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.3, which was
This file was extended by ugrep $as_me 7.0.4, 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.3
ugrep config.status 7.0.4
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.3],[https://github.com/Genivia/ugrep/issues],[ugrep],[https://ugrep.com])
AC_INIT([ugrep],[7.0.4],[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
2 changes: 1 addition & 1 deletion include/reflex/matcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Matcher : public PatternMatcher<reflex::Pattern> {
template<typename T>
static std::string convert(T regex, convert_flag_type flags = convert_flag::none, bool *multiline = NULL)
{
return reflex::convert(regex, "imsx#=^:abcdefhijklnrstuvwxzABDHLNQSUW<>?", flags, multiline);
return reflex::convert(regex, "imsx#=^:abcdefhijklnrstuvwxzABDHLNQSUW0<>?", flags, multiline);
}
/// Default constructor.
Matcher() : PatternMatcher<reflex::Pattern>()
Expand Down
2 changes: 1 addition & 1 deletion man/ug.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH UGREP "1" "November 10, 2024" "ugrep 7.0.3" "User Commands"
.TH UGREP "1" "November 12, 2024" "ugrep 7.0.4" "User Commands"
.SH NAME
\fBugrep\fR, \fBug\fR -- file pattern searcher
.SH SYNOPSIS
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" "November 10, 2024" "ugrep-indexer 7.0.3" "User Commands"
.TH UGREP-INDEXER "1" "November 12, 2024" "ugrep-indexer 7.0.4" "User Commands"
.SH NAME
\fBugrep-indexer\fR -- file indexer to accelerate recursive searching
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion man/ugrep.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH UGREP "1" "November 10, 2024" "ugrep 7.0.3" "User Commands"
.TH UGREP "1" "November 12, 2024" "ugrep 7.0.4" "User Commands"
.SH NAME
\fBugrep\fR, \fBug\fR -- file pattern searcher
.SH SYNOPSIS
Expand Down
11 changes: 8 additions & 3 deletions src/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2421,12 +2421,17 @@ void Query::view()

if (found)
{

Screen::clear();
Screen::put("Waiting on ");
Screen::put(command.c_str());
Screen::put(" to finish");
Screen::home();

// -n: add +line_number
if (line_number > 0)
command.append(" +").append(std::to_string(line_number));

Screen::clear();

FILE *pager = NULL;

#ifdef OS_WIN
Expand Down Expand Up @@ -2475,7 +2480,7 @@ void Query::view()
wcommand = utf8_decode(command);

// flush before calling _wsystem(), according to the Window's system API documentation
_flushall();
// _flushall(); removed because this may cause the TUI to freeze
#endif
}

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.3"
#define UGREP_VERSION "7.0.4"

// use a task-parallel thread to decompress the stream into a pipe to search, also handles nested archives
#define WITH_DECOMPRESSION_THREAD
Expand Down
18 changes: 13 additions & 5 deletions 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.3"
#define UGREP_VERSION "7.0.4"

// disable mmap because mmap is almost always slower than the file reading speed improvements since 3.0.0
#define WITH_NO_MMAP
Expand Down Expand Up @@ -132,8 +132,12 @@ inline std::string utf8_encode(const std::wstring &wstr)
if (wstr.empty())
return std::string();
int size = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], static_cast<int>(wstr.size()), NULL, 0, NULL, NULL);
std::string str(size, 0);
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], static_cast<int>(wstr.size()), &str[0], size, NULL, NULL);
std::string str;
if (size >= 0)
{
str.resize(size);
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], static_cast<int>(wstr.size()), &str[0], size, NULL, NULL);
}
return str;
}

Expand All @@ -143,8 +147,12 @@ inline std::wstring utf8_decode(const std::string &str)
if (str.empty())
return std::wstring();
int size = MultiByteToWideChar(CP_UTF8, 0, &str[0], static_cast<int>(str.size()), NULL, 0);
std::wstring wstr(size, 0);
MultiByteToWideChar(CP_UTF8, 0, &str[0], static_cast<int>(str.size()), &wstr[0], size);
std::wstring wstr;
if (size >= 0)
{
wstr.resize(size);
MultiByteToWideChar(CP_UTF8, 0, &str[0], static_cast<int>(str.size()), &wstr[0], size);
}
return wstr;
}

Expand Down
10 changes: 8 additions & 2 deletions src/vkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,14 +780,15 @@ bool VKey::setup(int mode)
inMode |= ENABLE_WINDOW_INPUT;

#ifdef VKEY_WIN
inMode |= ENABLE_VIRTUAL_TERMINAL_INPUT;
inMode |= ENABLE_VIRTUAL_TERMINAL_INPUT | ENABLE_EXTENDED_FLAGS;
#endif

if (!SetConsoleMode(hConIn, inMode))
return false;

#ifdef CP_UTF8
SetConsoleCP(CP_UTF8);
oldOutputCP = GetConsoleOutputCP();
SetConsoleOutputCP(CP_UTF8);
#endif

#else
Expand Down Expand Up @@ -844,6 +845,10 @@ void VKey::cleanup()
CloseHandle(hConIn);
}

#ifdef CP_UTF8
SetConsoleOutputCP(oldOutputCP);
#endif

#else

tcsetattr(tty, TCSAFLUSH, &oldterm);
Expand Down Expand Up @@ -898,6 +903,7 @@ void VKey::map_fn_key(unsigned num, const char *keys)
// Windows console state
HANDLE VKey::hConIn;
DWORD VKey::oldInMode;
UINT VKey::oldOutputCP;

#else

Expand Down
1 change: 1 addition & 0 deletions src/vkey.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ class VKey {
// Windows console state
static HANDLE hConIn;
static DWORD oldInMode;
static UINT oldOutputCP;

#else

Expand Down

0 comments on commit ffd990f

Please sign in to comment.