From f0fe44f35504788edc241e347252384517a33087 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 6 Sep 2020 20:40:29 -0400 Subject: Add C-r, C-s for basic scrollback search --- catgirl.1 | 6 +++++- ui.c | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/catgirl.1 b/catgirl.1 index 6e9f867..ad2b3a2 100644 --- a/catgirl.1 +++ b/catgirl.1 @@ -1,4 +1,4 @@ -.Dd September 3, 2020 +.Dd September 6, 2020 .Dt CATGIRL 1 .Os . @@ -459,6 +459,10 @@ Redraw the UI. Switch to next window. .It Ic C-p Switch to previous window. +.It Ic C-r +Scroll to previous line matching input. +.It Ic C-s +Scroll to next line matching input. .It Ic C-v Scroll down a page. .It Ic M-- diff --git a/ui.c b/ui.c index 4178d8f..676f969 100644 --- a/ui.c +++ b/ui.c @@ -518,6 +518,17 @@ static void windowScrollHot(struct Window *window, int dir) { } } +static void +windowScrollSearch(struct Window *window, const char *str, int dir) { + size_t from = BufferCap - window->scroll - MAIN_LINES + MarkerLines + dir; + for (size_t i = from; i < BufferCap; i += dir) { + const struct Line *line = bufferHard(window->buffer, i); + if (!line || !strcasestr(line->str, str)) continue; + windowScrollTo(window, BufferCap - i); + break; + } +} + struct Util uiNotifyUtil; static void notify(uint id, const char *str) { if (!uiNotifyUtil.argc) return; @@ -877,6 +888,8 @@ static void keyCtrl(wchar_t ch) { break; case L'L': clearok(curscr, true); break; case L'N': uiShowNum(windows.show + 1); break; case L'P': uiShowNum(windows.show - 1); + break; case L'R': windowScrollSearch(window, editBuffer(NULL), -1); + break; case L'S': windowScrollSearch(window, editBuffer(NULL), +1); break; case L'T': edit(id, EditTranspose, 0); break; case L'U': edit(id, EditDeleteHead, 0); break; case L'V': windowScrollPage(window, -1); -- cgit 1.4.0 /td>
path: root/etc/pacman.conf (unfollow)
Commit message (Expand)Author
2013-06-07Tweak ncmpcpp configJune McEnroe
2013-05-30Update terminal configurationJune McEnroe
2013-05-30Update ncmpcpp configurationJune McEnroe
2013-05-20Do not force update, just notifyJune McEnroe
2013-05-15Require pp in IRBJune McEnroe
2013-05-12Only run pacman on zsh start if it existsJune McEnroe
2013-05-09Add mplayer configurationJune McEnroe
2013-05-08Float mplayer2 windowsJune McEnroe
2013-05-04Update awesome themeJune McEnroe
2013-04-27Update terminal colors with proper base16 paletteJune McEnroe
2013-04-27Update location of Xfce4-Terminal configurationJune McEnroe
2013-04-24Update system configurationsJune McEnroe
2013-04-23Fix terminal colorsJune McEnroe
2013-04-14Start xcompmgrJune McEnroe
2013-04-06Drop pacman-color, regular pacman now has colorJune McEnroe
2013-04-06Restore wallpaper automaticallyJune McEnroe
2013-03-22Simplify autostartJune McEnroe
2013-02-24Default to Ruby 2.0June McEnroe
2013-01-26Make pretty riplrcJune McEnroe
2013-01-26Default to awesome sessionJune McEnroe
2013-01-26Add git promptJune McEnroe
2013-01-26Actually port awesome config to 3.5June McEnroe
2013-01-26Make pretty zshrcJune McEnroe
2013-01-26Port awesome config to 3.5June McEnroe
2013-01-26Replace RVM with chrubyJune McEnroe