about summary refs log tree commit diff
path: root/ui.c (follow)
Commit message (Collapse)AuthorAge
* Parse IRC formatting in timestamp stringJune McEnroe2021-10-28
| | | | | | | | | | | | Strip formatting when calculating the timestamp width to avoid moving a bunch of code around. Use styleAdd (now with an initial style parameter) to show timestamps. This allows changing the style of the timestamps from the default gray using literal IRC formatting codes in the string. Not ideal, but no new options needed. Suggested by Hoël Bézier and Sebastian LaVine.
* Fix missing include for flock(2)June McEnroe2021-08-09
| | | | | | On OpenBSD it's in <fcntl.h>, and it gets declared anyway on FreeBSD and macOS. Curiously, on GNU/Linux, LOCK_* are defined, but flock(2) isn't declared.
* Don't apply uiThreshold to Network and DebugJune McEnroe2021-07-20
| | | | | | | Messages don't really need to be hidden from <network> and I think it could be confusing. Debug messages are all Cold so everything would be hidden, and I want to keep them that way so that <debug> doesn't clutter the status line needlessly.
* Add -q/quiet option to raise default message visibility thresholdKlemens Nanni2021-07-20
| | | | | | | | | | | Silencing all windows with `M-+' (across multiple catgirl instances) can be cumbersome, so provide an option to hide events, JOIN/PART noise, etc. by default (each window's threshold will persist across load/save cycles, i.e. when using the `-s/save' option). Started out as `-v | visibility = threshold' to set a specific level, the idea of a simpler toggle comes from june, who also squashed other bugs (as usual).
* FreeBSD: Avoid caph_stream_rights(3)June McEnroe2021-07-13
| | | | | | | | caph_stream_rights(3) doesn't exist before FreeBSD 13.0 and there's no good reason to create that dependency. I still run servers on FreeBSD 12. This is a partial revert of cbc9545cb3f76733030c867f32ddb6a922cd2907.
* FreeBSD: Use capsicum_helpers.hJune McEnroe2021-06-28
|
* FreeBSD: Limit rights on save fileJune McEnroe2021-06-25
|
* Open save file with CLOEXECJune McEnroe2021-06-21
| | | | | Otherwise a lingering process from /copy for example could hold the lock.
* /exec without controlling terminalKlemens Nanni2021-06-13
| | | | | | | | | | | Otherwise "/exec sh </dev/tty" takes over and catgirl must effectively be killed to stop the madness; with this diff: catgirl input| /exec sh </dev/tty catgirl output| /bin/sh: cannot open /dev/tty: Device not configured catgirl output| Process exits with status 1 Do the same for `-C/Copy', `-N/notify' and `-O/open' alike.
* Fix unknown file signature errorJune McEnroe2021-06-11
|
* Exclusively lock save fileJune McEnroe2021-06-11
| | | | | Prevents two instances of catgirl from using the same save file and clobbering each other's data.
* Open save file with "a+"June McEnroe2021-06-11
| | | | | | Avoids another small TOCTOU. Rewind before loading since "a+" sets the file position at the end. Remove unnecessary fseek after truncation, since "a+" always writes at the end of the file.
* Open save file once in uiLoad() and keep it open until uiSave()Klemens Nanni2021-06-11
| | | | | | | | | | | | | | | | | 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.
* Rename file to saveFileKlemens Nanni2021-06-11
| | | | | Separate churn from actual change in upcoming diff, no functional change.
* Replace catf with seprintfJune McEnroe2021-06-09
|
* Avoid writing past the end of the status barMichael Forney2021-06-05
| | | | | | | | | | | | | | | 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.
* List windows with /window 1.8June McEnroe2021-05-28
| | | | Reuse the /window command to preserve /wi abbreviation.
* Add C-z keys for directly inserting most color codesJune McEnroe2021-03-17
| | | | | So you don't have to remember those dang numbers whose order makes no sense!
* Reset style after newline in inputJune McEnroe2021-03-17
| | | | Reflect what will actually be sent.
* Show where too-long-messages will be automatically splitJune McEnroe2021-03-17
|
* Add bindings for C-Left and C-RightJune McEnroe2021-03-07
| | | | | | | | 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.
* Add all window names to global completionJune McEnroe2021-03-02
| | | | | Don't want to be touching window names much though, otherwise query window names would interfere with tab completion within a channel.
* Add workaround for lack of A_ITALIC in old ncursesJune McEnroe2021-02-27
| | | | | | | | | | | | | 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.
* Add C-z p to manually toggle paste modeJune McEnroe2021-02-15
| | | | | | 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...
* Refactor Focus and Paste mode stringsJune McEnroe2021-02-15
|
* Add C-z C-v for literal nextJune McEnroe2021-02-03
| | | | | | | | | 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.
* Also skip marking swap windowJune McEnroe2021-01-31
| | | | Third time's the charm?
* Actually scroll to first line for "scroll to top"June McEnroe2021-01-29
|
* Only skip setting swap in windowShowJune McEnroe2021-01-29
| | | | | | 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.
* Move threshold and mute indicators directly after numberJune McEnroe2021-01-28
| | | | | | 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.
* Save window time display toggleJune McEnroe2021-01-27
|
* Measure timestamp width using ncursesJune McEnroe2021-01-27
| | | | | This allows for non-ASCII characters in timestamps, and simplifies things by including the trailing space in the width.
* Change default timestamp format to %XJune McEnroe2021-01-27
| | | | This respects the user's locale settings.
* Add toggleable display of timestampsJune McEnroe2021-01-27
|
* Only list up until scroll position with M-lJune McEnroe2021-01-26
|
* Preserve scroll position across reflowsJune McEnroe2021-01-26
| | | | | | | | | | | | 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.
* Rename and move scroll functions closer to where they are usedJune McEnroe2021-01-26
|
* Factor out windowReflowJune McEnroe2021-01-26
|
* Disable notify in restricted modeJune McEnroe2021-01-25
| | | | | catgirl shouldn't try to execute a command if it is misconfigured with both restrict and notify.
* Don't print timestamps for blank lines in bufferListJune McEnroe2021-01-25
|
* Simplify windowUpdate loops and factor out windowTopJune McEnroe2021-01-21
| | | | | No idea why I made that more complicated than it had to be looping backwards.
* Don't lose swapped window when navigating to current bufferJeremy O'Brien2021-01-19
|
* Use Warm heat for manually inserted blank linesJune McEnroe2021-01-19
| | | | Oops, forgot about these.
* Use Warm heat for blank lines 1.5June McEnroe2021-01-17
| | | | So they're not hidden by M-+.
* Save and load window visibility thresholdsJune McEnroe2021-01-16
|
* Restore toggling ignore with M--June McEnroe2021-01-16
| | | | So that pressing M-- repeatedly maintains the previous behavior.
* Generalize ignore toggling to visibility thresholdJune McEnroe2021-01-16
|
* Save and load the URL ring in the save file 1.4June McEnroe2021-01-11
|
* Avoid eating C-c while connectingJune McEnroe2020-10-12
| | | | | Split UI initialization into two steps either side of the call to connect, so that C-c works as interrupt while it's blocked.
* Factor out styleStripJune McEnroe2020-10-09
|