summary refs log tree commit diff
path: root/ui.c
AgeCommit message (Collapse)Author
2021-06-11Open save file once in uiLoad() and keep it open until uiSave()Klemens Nanni
Opening the same file *path* twice is a TOCTOU, although not a critical one: worst case we load from one file and save to another - the impact depends on how and when catgirl is started the next anyway. More importantly, keeping the file handle open at runtime allows us to drop all filesystem related promises for `-s/save' on OpenBSD. uiLoad() now opens "r+", meaning "Open for reading and writing." up front so uiSave() can write to it. In the case of a nonexistent save file, it now opens with "w" meaning "Open for writing. The file is created if it does not exist.", i.e. the same write/create semantics as "w" except uiLoad() no longer truncates. existing files. uiSave() now truncates the save file to avoid appending in general.
2021-06-11Rename file to saveFileKlemens Nanni
Separate churn from actual change in upcoming diff, no functional change.
2021-06-09Replace catf with seprintfC. McEnroe
2021-06-05Avoid writing past the end of the status barMichael Forney
When waddnstr is called with a string that would extend past the end of the window, the string is truncated, the cursor remains at the last column, and ERR is returned. If this error is ignored and the loop continues, the next call to waddnstr overwrites the character at this column, resulting in a slight visual artifact. When the window is too small to fit the full status line, it is effectively truncated by one space on the right, since the string shown for each channel begins with a space. Additionally, if the last window is the current window, the space is shown with a colored background. To fix this, when waddnstr returns ERR, exit the loop in styleAdd() early return -1 to propogate this error down to the caller.
2021-05-28List windows with /window 1.8C. McEnroe
Reuse the /window command to preserve /wi abbreviation.
2021-03-17Add C-z keys for directly inserting most color codesC. McEnroe
So you don't have to remember those dang numbers whose order makes no sense!
2021-03-17Reset style after newline in inputC. McEnroe
Reflect what will actually be sent.
2021-03-17Show where too-long-messages will be automatically splitC. McEnroe
2021-03-07Add bindings for C-Left and C-RightC. McEnroe
Apparently these are common. There's no terminfo for these, so manually define the xterm sequences. There's no documentation in the manual for the "intuitive" keys... I'm not sure if that should continue to be the case or not.
2021-03-02Add all window names to global completionC. McEnroe
Don't want to be touching window names much though, otherwise query window names would interfere with tab completion within a channel.
2021-02-27Add workaround for lack of A_ITALIC in old ncursesC. McEnroe
A_BLINK has probably always existed, but there's no good reason to ever use it, so make it do italics instead. Normally all attributes are set by a single set_attributes string if it's set, so clear it to force ncurses to use the reassigned enter_blink_mode string. If the terminal has no enter_italics_mode string, then nothing will happen. This makes setting multiple attributes a bit less efficient, but I don't think it's likely to make much of a difference since using multiple attributes at once is so uncommon.
2021-02-15Add C-z p to manually toggle paste modeC. McEnroe
OpenBSD's xterm doesn't have bracketed paste mode, and it would be nice to still be able to paste in several lines and collapse them with M-q, provided one remembers to type C-z p first...
2021-02-15Refactor Focus and Paste mode stringsC. McEnroe
2021-02-03Add C-z C-v for literal nextC. McEnroe
A little annoying to make it a "chord" like this, but C-v is already used for scrolling, following Emacs-style key bindings (in order to have a way to scroll without using "special" keys like the arrows and page up/down), and C-z is at least already in the business of inserting control characters. This makes it possible to manually enter some things that are otherwise only possible with /exec printf.
2021-01-31Also skip marking swap windowC. McEnroe
Third time's the charm?
2021-01-29Actually scroll to first line for "scroll to top"C. McEnroe
2021-01-29Only skip setting swap in windowShowC. McEnroe
With the early return, mainUpdate doesn't get called in cases where other functions expect windowShow to call it, such as when closing or moving windows.
2021-01-28Move threshold and mute indicators directly after numberC. McEnroe
I don't know why I ruled this out originally, it's more visually pleasing to me now especially that threshold is likely to remain set at "+" for a long time.
2021-01-27Save window time display toggleC. McEnroe
2021-01-27Measure timestamp width using ncursesC. McEnroe
This allows for non-ASCII characters in timestamps, and simplifies things by including the trailing space in the width.
2021-01-27Change default timestamp format to %XC. McEnroe
This respects the user's locale settings.
2021-01-27Add toggleable display of timestampsC. McEnroe
2021-01-26Only list up until scroll position with M-lC. McEnroe
2021-01-26Preserve scroll position across reflowsC. McEnroe
Finally! Changing the message visibility threshold doesn't totally screw up scroll position. Neither do horizontal resizes, but vertical resizes drift because the value of windowTop() changes before and after... The scroll position is anchored to the top of the window. It's arbitrary whether to anchor the top or the bottom, but other scrolling commands like M-p and C-r are anchored to the top, so this is consistent.
2021-01-26Rename and move scroll functions closer to where they are usedC. McEnroe
2021-01-26Factor out windowReflowC. McEnroe
2021-01-25Disable notify in restricted modeC. McEnroe
catgirl shouldn't try to execute a command if it is misconfigured with both restrict and notify.
2021-01-25Don't print timestamps for blank lines in bufferListC. McEnroe
2021-01-21Simplify windowUpdate loops and factor out windowTopC. McEnroe
No idea why I made that more complicated than it had to be looping backwards.
2021-01-19Don't lose swapped window when navigating to current bufferJeremy O'Brien
2021-01-19Use Warm heat for manually inserted blank linesC. McEnroe
Oops, forgot about these.
2021-01-17Use Warm heat for blank lines 1.5C. McEnroe
So they're not hidden by M-+.
2021-01-16Save and load window visibility thresholdsC. McEnroe
2021-01-16Restore toggling ignore with M--C. McEnroe
So that pressing M-- repeatedly maintains the previous behavior.
2021-01-16Generalize ignore toggling to visibility thresholdC. McEnroe
2021-01-11Save and load the URL ring in the save file 1.4C. McEnroe
2020-10-12Avoid eating C-c while connectingC. McEnroe
Split UI initialization into two steps either side of the call to connect, so that C-c works as interrupt while it's blocked.
2020-10-09Factor out styleStripC. McEnroe
2020-09-09Silence set-but-unused warning 1.2C. McEnroe
getyx is so annoying this way.
2020-09-07Add blank line to unread if there are already unreadC. McEnroe
This fixes the inconsistent M-u behaviour when catgirl is restarting and reconnecting to pounce, for example.
2020-09-07Call uiWrite to insert blank linesC. McEnroe
It only used to use different code to avoid adding the blank line to the soft buffer.
2020-09-06Add C-r, C-s for basic scrollback searchC. McEnroe
2020-09-03Add M-n, M-p to jump to highlightsC. McEnroe
2020-09-03Fix M-u behaviour difference before and after reflowC. McEnroe
2020-09-02Recalculate unreadHard on reflowC. McEnroe
2020-09-02Give blank lines timestampsC. McEnroe
Otherwise the zero timestamps totally break save data loading! Bad!
2020-09-02Hide ignored messages at the soft -> hard buffer layerC. McEnroe
This restores normal scrolling behaviour.
2020-09-02Still add ignored lines to unreadHardC. McEnroe
Scrolling is still affected by hidden lines (which I'm not sure yet is good or not), so for M-u to work it needs to count ignored lines.
2020-09-02Actually insert blank lines in the soft bufferC. McEnroe
So they can be preserved forever!
2020-09-02Reimplement split scrollingC. McEnroe