Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always re-render prompt while navigating history #18

Merged
merged 2 commits into from
Nov 23, 2021

Conversation

alexey-milovidov
Copy link
Member

See AmokHuginnsson#130

PS.

milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git checkout master
Switched to branch 'master'
Your branch and 'origin/master' have diverged,
and have 13 and 107 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git fetch
From https://github.com/ClickHouse-Extras/replxx
 + 68410ac...f97765d master     -> origin/master  (forced update)
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git reset --hard origin/master
HEAD is now at f97765d Merge pull request #17 from azat-archive/replxx-incremental_history_search-fix-upstream
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git checkout master-old 
Switched to branch 'master-old'
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git reset --hard origin/master
HEAD is now at f97765d Merge pull request #17 from azat-archive/replxx-incremental_history_search-fix-upstream
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git push origin-ssh
Total 0 (delta 0), reused 0 (delta 0)
remote: 
remote: Create a pull request for 'master-old' on GitHub by visiting:
remote:      https://github.com/ClickHouse-Extras/replxx/pull/new/master-old
remote: 
To github.com:ClickHouse-Extras/replxx.git
 * [new branch]      master-old -> master-old
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git fetch [email protected]:AmokHuginnsson/replxx.git master
From github.com:AmokHuginnsson/replxx
 * branch            master     -> FETCH_HEAD
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git reset --hard FETCH_HEAD
HEAD is now at 68410ac Add history_move_{next/prevoius}
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git push --force origin-ssh
Total 0 (delta 0), reused 0 (delta 0)
To github.com:ClickHouse-Extras/replxx.git
 + f97765d...68410ac master -> master (forced update)
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git checkout -b amosbird-rerenderprompt
Switched to a new branch 'amosbird-rerenderprompt'
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git pull [email protected]:amosbird/replxx.git rerenderprompt
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0
Unpacking objects: 100% (5/5), 1009 bytes | 252.00 KiB/s, done.
From github.com:amosbird/replxx
 * branch            rerenderprompt -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: Add history_move_{next/prevoius}
milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git push origin-ssh
Enumerating objects: 26, done.
Counting objects: 100% (26/26), done.
Delta compression using up to 32 threads
Compressing objects: 100% (11/11), done.
Writing objects: 100% (16/16), 2.77 KiB | 2.77 MiB/s, done.
Total 16 (delta 13), reused 6 (delta 5)
remote: Resolving deltas: 100% (13/13), completed with 9 local objects.
remote: 
remote: Create a pull request for 'amosbird-rerenderprompt' on GitHub by visiting:
remote:      https://github.com/ClickHouse-Extras/replxx/pull/new/amosbird-rerenderprompt
remote: 
To github.com:ClickHouse-Extras/replxx.git
 * [new branch]      amosbird-rerenderprompt -> amosbird-rerenderprompt

amosbird and others added 2 commits November 20, 2021 21:11
Right now there is UP/DOWN arrows, that is binded to
history_prevous/history_next accordingly.

But in case of multiline history entry it will navigate through the
lines in the current history itemfirst, and this may not be the requird
behavior.

So now replxx will have history_move_*, that will always navigate
through history, regardless of new lines in query.

New history_move_{next/prev} binded to M-UP/M-DOWN (like in readline).
@alexey-milovidov alexey-milovidov changed the title Amosbird rerenderprompt Always re-render prompt while navigating history Nov 23, 2021
@alexey-milovidov alexey-milovidov merged commit f019cba into master Nov 23, 2021
@azat
Copy link

azat commented Nov 24, 2021

milovidov@milovidov-desktop:~/work/ClickHouse/contrib/replxx$ git pull [email protected]:amosbird/replxx.git rerenderprompt
...
From github.com:amosbird/replxx
 * branch            rerenderprompt -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: Add history_move_{next/prevoius}

It seems that you have pull.rebase=true and so now history looks a bit odd:

$ git oneline ch/master -4
f019cba (ch/master) Merge pull request #18 from ClickHouse-Extras/amosbird-rerenderprompt
7de81e3 (ch/amosbird-rerenderprompt) Add history_move_{next/prevoius}
453bd9a Always re-render prompt while navigating history
68410ac (HEAD, origin/master, origin/HEAD, master) Add history_move_{next/prevoius}

So 7de81e3 is identical to the original commit 68410ac

@Felixoid
Copy link
Member

*   f019cba (HEAD, origin/master, origin/HEAD) Merge pull request #18 from ClickHouse-Extras/amosbird-rerenderprompt
|\  
| * 7de81e3 (origin/amosbird-rerenderprompt) Add history_move_{next/prevoius}
| * 453bd9a Always re-render prompt while navigating history
* | 68410ac Add history_move_{next/prevoius}
|/  
* f1bf1a5 ReplxxImpl: Enable raw mode in `input()` under lock.```

Looks a bit strange, but still does the job.

Not sure though that it's `pull.rebase=true`. I have it too, but I feel like it does the trick in another way around

@alexey-milovidov
Copy link
Member Author

Yes, I did not want rebase, but it's ok nevertheless.

azat added a commit to azat-ch/replxx that referenced this pull request Sep 4, 2022
You may get uncaugh exception (in case of i.e. broken pipe):

    terminating with uncaught exception of type std::runtime_error: write failed

On destroy:

    (lldb) target create "clickhouse-22.8-release" --core "core.clickhouse-clie.402986-642410"
    bt
    Core file '/wrk/core.clickhouse-clie.402986-642410' (x86_64) was loaded.
    (lldb) bt
    * thread ClickHouse#1, name = 'clickhouse-clie', stop reason = signal SIGABRT
      * frame #0: 0x00007f03fb5c900b libc.so.6`raise + 203
        frame ClickHouse#1: 0x00007f03fb5a8859 libc.so.6`abort + 299
        frame ClickHouse#2: 0x000000001b703f44 clickhouse-22.8-release`::abort_message(format=<unavailable>) at abort_message.cpp:78:5
        frame ClickHouse#3: 0x000000001b703dd4 clickhouse-22.8-release`demangling_terminate_handler() at cxa_default_handlers.cpp:67:21
        frame ClickHouse#4: 0x000000001b721063 clickhouse-22.8-release`std::__terminate(func=<unavailable>)()) at cxa_handlers.cpp:59:9
        frame ClickHouse#5: 0x000000001b720fce clickhouse-22.8-release`std::terminate() at cxa_handlers.cpp:88:17
        frame ClickHouse#6: 0x000000000a3b21db clickhouse-22.8-release`__clang_call_terminate + 11
        frame ClickHouse#7: 0x00000000189b1bfc clickhouse-22.8-release`replxx::Replxx::ReplxxImpl::~ReplxxImpl(this=0x00007f03fa945308) at replxx_impl.cxx:336:1
        frame ClickHouse#8: 0x00000000189b1ce9 clickhouse-22.8-release`replxx::Replxx::ReplxxImpl::~ReplxxImpl(this=0x00007f03fa945300) at replxx_impl.cxx:334:41
        frame ClickHouse#9: 0x00000000188b0644 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader() [inlined] std::__1::unique_ptr<replxx::Replxx::ReplxxImpl, void (*)(replxx::Replxx::ReplxxImpl*)>::reset(this=<unavailable>, __p=<unavailable>) at unique_ptr.h:315:7
        frame ClickHouse#10: 0x00000000188b0626 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader() [inlined] std::__1::unique_ptr<replxx::Replxx::ReplxxImpl, void (*)(replxx::Replxx::ReplxxImpl*)>::~unique_ptr(this=<unavailable>) at unique_ptr.h:269
        frame ClickHouse#11: 0x00000000188b0626 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader() [inlined] replxx::Replxx::~Replxx(this=<unavailable>) at replxx.hxx:76
        frame ClickHouse#12: 0x00000000188b0626 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader(this=0x00007ffd10038440) at ReplxxLineReader.cpp:229
        frame ClickHouse#13: 0x00000000158b2100 clickhouse-22.8-release`DB::ClientBase::runInteractive(this=0x00007ffd10038620) at ClientBase.cpp:2067:1
        frame ClickHouse#14: 0x000000000a4de372 clickhouse-22.8-release`DB::Client::main(this=0x00007ffd10038620, (null)=<unavailable>) at Client.cpp:261:9
        frame ClickHouse#15: 0x0000000018923a86 clickhouse-22.8-release`Poco::Util::Application::run(this=0x00007ffd10038620) at Application.cpp:334:8
        frame ClickHouse#16: 0x000000000a4ed341 clickhouse-22.8-release`mainEntryClickHouseClient(argc=39, argv=0x00007f03fa8201c0) at Client.cpp:1220:23
        frame ClickHouse#17: 0x000000000a3b17ab clickhouse-22.8-release`main(argc_=<unavailable>, argv_=<unavailable>) at main.cpp:449:12
        frame ClickHouse#18: 0x00007f03fb5aa083 libc.so.6`__libc_start_main + 243
        frame ClickHouse#19: 0x000000000a17032e clickhouse-22.8-release`_start + 46
azat added a commit to azat-ch/replxx that referenced this pull request Sep 4, 2022
You may get uncaugh exception (in case of i.e. broken pipe):

    terminating with uncaught exception of type std::runtime_error: write failed

On destroy:

    (lldb) target create "clickhouse-22.8-release" --core "core.clickhouse-clie.402986-642410"
    bt
    Core file '/wrk/core.clickhouse-clie.402986-642410' (x86_64) was loaded.
    (lldb) bt
    * thread ClickHouse#1, name = 'clickhouse-clie', stop reason = signal SIGABRT
      * frame #0: 0x00007f03fb5c900b libc.so.6`raise + 203
        frame ClickHouse#1: 0x00007f03fb5a8859 libc.so.6`abort + 299
        frame ClickHouse#2: 0x000000001b703f44 clickhouse-22.8-release`::abort_message(format=<unavailable>) at abort_message.cpp:78:5
        frame ClickHouse#3: 0x000000001b703dd4 clickhouse-22.8-release`demangling_terminate_handler() at cxa_default_handlers.cpp:67:21
        frame ClickHouse#4: 0x000000001b721063 clickhouse-22.8-release`std::__terminate(func=<unavailable>)()) at cxa_handlers.cpp:59:9
        frame ClickHouse#5: 0x000000001b720fce clickhouse-22.8-release`std::terminate() at cxa_handlers.cpp:88:17
        frame ClickHouse#6: 0x000000000a3b21db clickhouse-22.8-release`__clang_call_terminate + 11
        frame ClickHouse#7: 0x00000000189b1bfc clickhouse-22.8-release`replxx::Replxx::ReplxxImpl::~ReplxxImpl(this=0x00007f03fa945308) at replxx_impl.cxx:336:1
        frame ClickHouse#8: 0x00000000189b1ce9 clickhouse-22.8-release`replxx::Replxx::ReplxxImpl::~ReplxxImpl(this=0x00007f03fa945300) at replxx_impl.cxx:334:41
        frame ClickHouse#9: 0x00000000188b0644 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader() [inlined] std::__1::unique_ptr<replxx::Replxx::ReplxxImpl, void (*)(replxx::Replxx::ReplxxImpl*)>::reset(this=<unavailable>, __p=<unavailable>) at unique_ptr.h:315:7
        frame ClickHouse#10: 0x00000000188b0626 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader() [inlined] std::__1::unique_ptr<replxx::Replxx::ReplxxImpl, void (*)(replxx::Replxx::ReplxxImpl*)>::~unique_ptr(this=<unavailable>) at unique_ptr.h:269
        frame ClickHouse#11: 0x00000000188b0626 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader() [inlined] replxx::Replxx::~Replxx(this=<unavailable>) at replxx.hxx:76
        frame ClickHouse#12: 0x00000000188b0626 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader(this=0x00007ffd10038440) at ReplxxLineReader.cpp:229
        frame ClickHouse#13: 0x00000000158b2100 clickhouse-22.8-release`DB::ClientBase::runInteractive(this=0x00007ffd10038620) at ClientBase.cpp:2067:1
        frame ClickHouse#14: 0x000000000a4de372 clickhouse-22.8-release`DB::Client::main(this=0x00007ffd10038620, (null)=<unavailable>) at Client.cpp:261:9
        frame ClickHouse#15: 0x0000000018923a86 clickhouse-22.8-release`Poco::Util::Application::run(this=0x00007ffd10038620) at Application.cpp:334:8
        frame ClickHouse#16: 0x000000000a4ed341 clickhouse-22.8-release`mainEntryClickHouseClient(argc=39, argv=0x00007f03fa8201c0) at Client.cpp:1220:23
        frame ClickHouse#17: 0x000000000a3b17ab clickhouse-22.8-release`main(argc_=<unavailable>, argv_=<unavailable>) at main.cpp:449:12
        frame ClickHouse#18: 0x00007f03fb5aa083 libc.so.6`__libc_start_main + 243
        frame ClickHouse#19: 0x000000000a17032e clickhouse-22.8-release`_start + 46
nikitamikhaylov pushed a commit that referenced this pull request Aug 23, 2024
You may get uncaugh exception (in case of i.e. broken pipe):

    terminating with uncaught exception of type std::runtime_error: write failed

On destroy:

    (lldb) target create "clickhouse-22.8-release" --core "core.clickhouse-clie.402986-642410"
    bt
    Core file '/wrk/core.clickhouse-clie.402986-642410' (x86_64) was loaded.
    (lldb) bt
    * thread #1, name = 'clickhouse-clie', stop reason = signal SIGABRT
      * frame #0: 0x00007f03fb5c900b libc.so.6`raise + 203
        frame #1: 0x00007f03fb5a8859 libc.so.6`abort + 299
        frame #2: 0x000000001b703f44 clickhouse-22.8-release`::abort_message(format=<unavailable>) at abort_message.cpp:78:5
        frame #3: 0x000000001b703dd4 clickhouse-22.8-release`demangling_terminate_handler() at cxa_default_handlers.cpp:67:21
        frame #4: 0x000000001b721063 clickhouse-22.8-release`std::__terminate(func=<unavailable>)()) at cxa_handlers.cpp:59:9
        frame #5: 0x000000001b720fce clickhouse-22.8-release`std::terminate() at cxa_handlers.cpp:88:17
        frame #6: 0x000000000a3b21db clickhouse-22.8-release`__clang_call_terminate + 11
        frame #7: 0x00000000189b1bfc clickhouse-22.8-release`replxx::Replxx::ReplxxImpl::~ReplxxImpl(this=0x00007f03fa945308) at replxx_impl.cxx:336:1
        frame #8: 0x00000000189b1ce9 clickhouse-22.8-release`replxx::Replxx::ReplxxImpl::~ReplxxImpl(this=0x00007f03fa945300) at replxx_impl.cxx:334:41
        frame #9: 0x00000000188b0644 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader() [inlined] std::__1::unique_ptr<replxx::Replxx::ReplxxImpl, void (*)(replxx::Replxx::ReplxxImpl*)>::reset(this=<unavailable>, __p=<unavailable>) at unique_ptr.h:315:7
        frame #10: 0x00000000188b0626 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader() [inlined] std::__1::unique_ptr<replxx::Replxx::ReplxxImpl, void (*)(replxx::Replxx::ReplxxImpl*)>::~unique_ptr(this=<unavailable>) at unique_ptr.h:269
        frame #11: 0x00000000188b0626 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader() [inlined] replxx::Replxx::~Replxx(this=<unavailable>) at replxx.hxx:76
        frame #12: 0x00000000188b0626 clickhouse-22.8-release`ReplxxLineReader::~ReplxxLineReader(this=0x00007ffd10038440) at ReplxxLineReader.cpp:229
        frame #13: 0x00000000158b2100 clickhouse-22.8-release`DB::ClientBase::runInteractive(this=0x00007ffd10038620) at ClientBase.cpp:2067:1
        frame #14: 0x000000000a4de372 clickhouse-22.8-release`DB::Client::main(this=0x00007ffd10038620, (null)=<unavailable>) at Client.cpp:261:9
        frame #15: 0x0000000018923a86 clickhouse-22.8-release`Poco::Util::Application::run(this=0x00007ffd10038620) at Application.cpp:334:8
        frame #16: 0x000000000a4ed341 clickhouse-22.8-release`mainEntryClickHouseClient(argc=39, argv=0x00007f03fa8201c0) at Client.cpp:1220:23
        frame #17: 0x000000000a3b17ab clickhouse-22.8-release`main(argc_=<unavailable>, argv_=<unavailable>) at main.cpp:449:12
        frame #18: 0x00007f03fb5aa083 libc.so.6`__libc_start_main + 243
        frame #19: 0x000000000a17032e clickhouse-22.8-release`_start + 46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants