Commit Graph

956 Commits

Author SHA1 Message Date
uwe 463a9e2dfe curses: init old_mode to 1 (normal visible cursor)
PR bin/58090: Ctrl-Z, fg makes blinking cursor in vi
ok blymn@
2024-05-27 14:30:43 +00:00
uwe a9c500b2e8 curses: constify newterm() and setterm() arguments
newterm() argument is const in the spec, so this fixes our
conformance.

setterm() is not in the spec, but it's natural and in ncurses its
argument is const too, so follow suit.

Doesn't change the ABI, so no bump required.

ok blymn@
2024-05-17 23:32:50 +00:00
uwe 43b4276855 curses_input(3): bump date for define_key() change 2024-05-14 10:40:41 +00:00
uwe deeae7c15b curses_termcap(3): fullname() termbuf argument is const 2024-05-14 10:38:16 +00:00
uwe 97b9891f11 curse: constify define_key() argument
define_key() is ncurses extension and ncurses defines its first
argument as "const char *".  Follow suit.

PR lib/58254
2024-05-14 10:22:48 +00:00
blymn 8fb09d041c Correct the fd closed check so we actually check the outfd as per
the comment.  Thanks for jdc@netbsd.org for catching this one.
2023-10-09 21:14:29 +00:00
blymn 95dcd6ac86 Fix for install/56467
Set x to 0 before calling scroll based on a  proposed fix by RVP (thanks!)
2023-10-05 06:15:03 +00:00
msaitoh 37a23ecf39 Fix typo in comment. 2023-06-24 05:18:12 +00:00
uwe fadf4dba80 Fix spelling of Kurt Shoens surname.
PR misc/57389
2023-05-04 11:30:25 +00:00
blymn 3aed864489 Don't set the clear_to_eol variable in doupdate to NULL, this was a
leftover from previous code that makes no sense and makes worms(6)
crash randomly.  Thanks to kre@ for reporting this.
2023-04-28 07:12:39 +00:00
gutteridge d6bd763cb8 intro.5: fix typo and grammar and simplify a phrase 2023-02-20 02:05:47 +00:00
andvar 2773222a6c s/chracter/character/ in documentation. 2023-02-13 23:02:27 +00:00
blymn 0d33635b3c Add more debug so a call to waddbytes can be traced to the caller. 2022-12-21 06:18:01 +00:00
blymn 9c6a0e327d Backout change to addnstr that broke other applications as n should be
the number of bytes to add - for multibyte characters n will be > 1.

Fix __slk_draw to pass in the actual length of the label instead of
the default label length because wide characters may make the
actual string length longer than the slk display length.
2022-12-20 04:57:01 +00:00
blymn 7c304c7fb1 Default the character width to 1 if wcwidth fails. 2022-12-12 21:14:15 +00:00
blymn 5a712dcba0 Revert previous change, it is not correct. 2022-12-05 21:14:25 +00:00
blymn dabdb153f2 When performing a scroll, check the last line of the region is the same
on virtscr and curscr because the indexes past are supposed to be
one *past* the last matching line (they may actually match if the line is
at the bottom of the screen).  Iff they don't match reduce the scroll
region size by one so we don't scroll non-matching lines, also check
if the region is then 0 after the decrement and just return if it was.
2022-11-30 06:19:15 +00:00
blymn b34dd075af Count character widths not number of bytes when calculating number
of characters to add.  Fixes an error detected by slk tests where
a label containing wide characters was not correctly printed.
2022-11-07 21:18:49 +00:00
blymn 2cc268f92c PR bin/57072
This fixes observed behviour in the PR.  Allow the cursor to be
moved one past the EOL, if postitioned here then set ISPASTEOL.
also protect out of range access if win->cury is past maxy.
2022-11-04 06:12:22 +00:00
blymn 4b1b7fd71d Fix for lib/57050
Perform a sanity check on the window parameter being passed and return
ERR if it is null.  This prevents buggy code crashing.
2022-10-25 06:20:01 +00:00
blymn ee6c5161ec Fixes for lib/56926 amongst other things:
- plod now correctly accounts for wide characters when plodding
 - use erase line when in color mode if the terminal has the capability
 - ensure that the CA_CONTINUATION flag is applied consistently to the
   subsequent characters in a wide character.
 - fix a bunch of refresh bugs that caused inconsistent placement of
   wide characters.
2022-10-19 06:09:27 +00:00
andvar a299e6608d fix various typos in comments. 2022-07-06 12:33:41 +00:00
uwe 82b5ace373 curses_input.3: wtimeout() returns void too 2022-05-21 12:34:44 +00:00
charlotte 54e1935b39 curses_input.3: timeout() actually returns void 2022-05-21 06:22:49 +00:00
blymn 7b4e98e7d7 Set the last change pointer after adding a character at the bottom right
of a window.  This fixes the character missing in the LR of a window.
Thanks to uwe@ for pointing this out.
2022-05-19 07:41:26 +00:00
rillig 84c538f93b curses_input.3: fix argument type for keypad, notimeout, nodelay
There is no type named 'boolf', there's only 'bool'.
2022-05-16 20:09:13 +00:00
blymn 6bb8042d10 Make clrtoeol match the ncurses behaviour where it seems to make the
rest of line foreground.  This fixes a display oddity in mutt.
2022-05-12 22:25:38 +00:00
blymn 080c30e83d Don't force the refresh, it doesn't really need it. 2022-05-05 22:02:17 +00:00
blymn a7d2c21606 * Don't redraw the background if the new background character is the
same as the old one.  This prevents excessive redraws in some
   applications.

 * Fix bug introduced when wbkgrndset was fixed, we cannot blindly
   replace any instance of the old background character with the new one
   because some of those characters were put there by the application
   leading to display corruption.  So flag characters as background when
   they are erased and only update the flagged characters when setting
   the background.
2022-05-03 07:25:34 +00:00
blymn dbdfee8ed1 Fix for PR 56243
clear the past EOL flags when moving the cursor - they are no longer
valid as move cannot put the cursor past the EOL.
2022-04-27 22:04:04 +00:00
blymn a63e44ac26 Fix for PR 55517.
Actually us x values to recalculate subwin columns.
2022-04-26 22:40:32 +00:00
blymn 881239103e fix for PR 55496
* Fix bkgrndset so that it actually sets the background character in
   in line with the SUSv2 specification.

 * Add an internal function to copy a complex character

 * Make the previously static celleq function into a libcurses private
   function so that it can be called in other files.
2022-04-19 22:26:57 +00:00
rillig 388550b026 lib: remove CONSTCOND comment
Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
2022-04-19 20:32:14 +00:00
pgoyette 4c6c48d4bc Fix build (enabled only for MKDEBUG?) 2022-04-13 19:17:09 +00:00
blymn 137544432a Fix compile breakage when wide char support is disabled. 2022-04-12 21:54:16 +00:00
blymn 301bf8cc44 Make the default colour pair be pair 0 which appears to match other
curses implementations.
2022-04-12 07:03:04 +00:00
andvar 75d2abaeb1 fix various typos in comments and output/log messages. 2022-04-10 09:50:44 +00:00
andvar 146d03e698 s/postion/position/ 2022-04-08 10:27:04 +00:00
andvar 2fa7e14158 fix various typos, mainly in comments, but also log messages, docs, game text. 2022-04-08 10:17:52 +00:00
uwe f560b4a780 __makenew: use calloc to get zeroed memory for window contents.
PR lib/56767.
2022-03-26 16:03:02 +00:00
blymn f1942931a2 Correct (hopefully) the handling of wide characters.
* Remove the WCOL family of macros, these were "stealing" the upper bits
  of a character attribute to store the column width of a character.  No
  warning was given about this in curses.h which meant it was easy to
  accidentally reuse the bits in use by the WCOL macros (we already did).
  Add couple of 16bit ints to the character structure iff HAVE_WCHAR is
  true to hold the display width and wide char related flags (just
  continuation at the moment)
* Convert all instances of WCOL macros to just reference the column width
  in the char structure so it is not obfuscated.
* Fix cursor positioning so placing a cursor in the middle of a wide char
  actually does just that.
* Fix plod so it understands that if the cursor is going to be positioned
  in the middle of a wide char it cannot just reprint the char to get there.
* Fix plodput so it correctly counts the number of output characters for
  wide characters.
* Fix slk routines to properly size the wctomb() buffer.
2022-01-25 03:05:06 +00:00
rillig 7af2475f78 libcurses: remove unreachable statements
Found by lint.

No binary change.
2022-01-16 10:30:45 +00:00
blymn 47946660f2 Revert change for array definition, it was incorrect, thanks Uwe. 2022-01-06 20:50:18 +00:00
blymn ebe5c3e633 Properly size and array to hold the larget return from wctomb. 2022-01-06 06:18:13 +00:00
msaitoh 777518dc50 s/implemenation/implementation/ in comment. 2022-01-01 08:34:34 +00:00
uwe 017b38e5d1 curses: spell "foreground" correctly in comments 2021-12-17 03:50:18 +00:00
andvar 6012d766dc fix various typos in comments and log messages. 2021-12-08 20:50:01 +00:00
andvar d1c4e519a3 fix various typos in comments, log messages and documentation. 2021-12-03 13:27:37 +00:00
blymn fc986dbc59 Don't waste time setting the dirty flag multiple times. 2021-11-22 21:25:25 +00:00
kre 3ba1fc18cc Move 'i' into DEBUG only code (now there be three).
Hopefully unbreaks !DEBUG builds.
2021-11-16 23:23:02 +00:00