History log of /src/lib/libcurses/addbytes.c |
Revision | | Date | Author | Comments |
1.70 |
| 23-Dec-2024 |
blymn | Sprinkle about some cycle wasting checks for the win pointer being null. Unfortunately, ncurses does this and there is some sloppy code out there that relies on the check resulting in segfaults in NetBSD curses which then, of course, gets blamed for the error.
|
1.69 |
| 05-Oct-2023 |
blymn | branches: 1.69.2; Fix for install/56467
Set x to 0 before calling scroll based on a proposed fix by RVP (thanks!)
|
1.68 |
| 20-Dec-2022 |
blymn | 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.
|
1.67 |
| 12-Dec-2022 |
blymn | branches: 1.67.2; Default the character width to 1 if wcwidth fails.
|
1.66 |
| 07-Nov-2022 |
blymn | 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.
|
1.65 |
| 19-Oct-2022 |
blymn | 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.
|
1.64 |
| 19-May-2022 |
blymn | 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.
|
1.63 |
| 03-May-2022 |
blymn | * 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.
|
1.62 |
| 12-Apr-2022 |
blymn | Make the default colour pair be pair 0 which appears to match other curses implementations.
|
1.61 |
| 25-Jan-2022 |
blymn | 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.
|
1.60 |
| 16-Jan-2022 |
rillig | libcurses: remove unreachable statements
Found by lint.
No binary change.
|
1.59 |
| 06-Sep-2021 |
rin | Style fixes most for __CTRACE().
|
1.58 |
| 06-Sep-2021 |
rin | Unifdef DEBUG for CTRACE().
|
1.57 |
| 22-Jun-2021 |
blymn | Rework the fix for lib/56224. Move the scroll check to _cursesi_addwchar Perform the scroll check before updating the cursor location when processing \n.
|
1.56 |
| 15-Jun-2021 |
blymn | Correct a previous fix for PR lib/56224. Use wdwitch to determine the width of a wide character on the screen not the number from mbrtowc which is the number of bytes in the character. Thanks to Michael Forney for spotting this.
|
1.55 |
| 06-Jun-2021 |
blymn | Fix for PR lib/56224 Correct addstr behaviour so it truncates the string in the case where a string is added on the bottom line of a window where scrolling is disabled as per the SUSv2 specification.
|
1.54 |
| 13-Feb-2021 |
rillig | branches: 1.54.4; libcurses: fix wrong tab width for addch
In sysinst, the installation screen is indented with tabs. Sysinst uses msgc, which brings its own text layout engine. This engine does not use addbytes but addch. In addch, the x position for each tab was advanced twice as much as needed. The menu items were thus not indented by 8 spaces but by 16, which caused an ugly line break in the German translation.
This bug largely went unnoticed because most other applications use addbytes instead, which worked fine all the time. It had been introduced somewhere between NetBSD 8.0 and NetBSD 9.0.
The code around this bug used aliased variables for win->curx and win->cury a lot. Getting this right is difficult and needs a thorough test suite. Even though libcurses has 201 tests, that is not nearly enough to cover all the relations between the various functions in libcurses that call each other, crossing API boundaries from internal to external, doing character conversions on the way and juggling around 4 different types of characters (char, wchar_t, chtype, cchar_t).
The simplest fix was to remove all this aliasing, while keeping the API the same. If _cursesi_waddbytes is not considered part of the API, it would be possible to replace px with win->curx in all places, same for py and win->cury.
The complicated code with the aliasing may have been meant for performance reasons, but it's hard to see any advantage if both points of truth need to be synchronized all the time.
Libcurses can be built in 2 modes: with wide character support or without (-DDISABLE_WCHAR). The test suite only covers the variant with wide characters. The single-byte variant has to be tested manually. Running sysinst with the single-byte libcurses produces the correct layout.
|
1.53 |
| 06-Feb-2021 |
rillig | libcurses: fix spelling in comment
|
1.52 |
| 09-Jun-2019 |
blymn | Rework previous fix for getch cursor position when cursor is moved without refresh. If the window is not dirty but the window cursor position does not match curscr then move the cursor. This fixes the issues seen in PR lib/54263.
|
1.51 |
| 20-May-2019 |
blymn | Back out incorrect fix for PR 53617 and fix it in a different way. Keep track of the cursor location, if getch is called without a refresh and without pending updates (dirty windows) then move the cursor to the correct location directly. Doing this prevents unnecessary refreshes.
|
1.50 |
| 12-May-2019 |
blymn | Fix _cursesi_addwchar so that it performs line wrap. SUSv2 says add_wch line wraps and updates position. Since wrap is done we are not past EOL.
|
1.49 |
| 15-Nov-2018 |
uwe | _cursesi_addbyte - fix function comment after what looks like an editing accident.
|
1.48 |
| 08-Aug-2018 |
simonb | Avoid curx going beyond end of window when adding a wide character to the last column.
OK @blymn.
|
1.47 |
| 06-Jan-2017 |
roy | branches: 1.47.6; 1.47.12; 1.47.14; KNF
|
1.46 |
| 06-Jan-2017 |
roy | KNF
|
1.45 |
| 02-Jan-2017 |
roy | Implement POSIX Curses functions immedok(3) and syncok(3).
|
1.44 |
| 28-Nov-2016 |
christos | If we are inserting spaces to account for a tab, move the x position of the cursor, otherwise this is a no-op (Carsten Kunze)
|
1.43 |
| 22-Oct-2016 |
christos | remove bogus malloc casts
|
1.42 |
| 10-Nov-2013 |
christos | branches: 1.42.4; 1.42.8; remove unused variable
|
1.41 |
| 09-Nov-2013 |
blymn | Rename the old __waddbytes function to _cursesi_waddbytes and add a parameter that controls whether or not certain characters in the string are interpreted or not (things like tab being expanded).
Make __waddbytes a wrapper for _cursesi_waddbytes that passes all parameters and sets the flag for character interpretation for backward compatibility.
Fix an incipient bug in _cursesi_waddbytes where garbage would have been written to the terminal if the terminal TABSIZE was set > 8 and character interpretation is on.
Convert all internal __waddbytes calls to use _cursesi_waddbytes, fix the function prototypes and add a new flag that will be used later.
Fix the addchstr family functions so that they call _cursesi_waddbytes with character interpretation off as per SUSV2.
|
1.40 |
| 16-Oct-2013 |
roy | Add TABSIZE, which is derived from terminfo init_tabs. Use this when processing \t. If TABSIZE is set in the environment, this takes precedence.
|
1.39 |
| 01-Jul-2011 |
joerg | branches: 1.39.2; 1.39.8; Fix memset usage.
|
1.38 |
| 16-Dec-2010 |
wiz | Observe the following spelling: - wide character (noun) - wide-character (adjective)
Inspired by jmc@OpenBSD.
|
1.37 |
| 23-Nov-2010 |
tnozaki | to initialize mbstate_t, use memset instead mbrtowc.
|
1.36 |
| 23-Feb-2010 |
drochner | misc fixes and improvements: -call setlocale(LC_CTYPE, "") before nl_langinfo(CODESET) if the locale settings is (still) at "C" - otherwise the CODESET doesn't work -fix the type of the WACS_* symbols -- this needs to be cchar_t* -add safeguards where the return value of wcwidth() is used for loop counters or indexing -- it can be -1 -use more common code in the widechar support case -- in particular let the wchar functions do the work even if chtype ones were called -implement wcursyncup/wsyncup/wsyncdown -somewhat experimental: allow ACS_* variables to refer to WACS_* table entries -- this way, programs using the old chtype using API can use UTF8 line drawing on terminals which support UTF8 but not ACS switching -fix some logics bugs in UTF8 recognition and ALTCHARSET handling
|
1.35 |
| 22-Jul-2009 |
roy | Prepare curses for the possibility of changing from termcap to terminfo. term.h #defines lines, pad_char and no_color_video macros which conflict with existing curses code. We change lines to alines and nlines depending on use, pad_char to padchar and no_color_video becomes no_color_attributes but with a strong alias from no_color_video.
|
1.34 |
| 04-Jul-2008 |
tnozaki | use mbrtowc() instead of mbtowc().
|
1.33 |
| 08-Nov-2007 |
jdc | branches: 1.33.8; Fix the handling for added carriage return characters.
Should fix the "staircase effect" part of PR 36560.
|
1.32 |
| 28-May-2007 |
blymn | branches: 1.32.4; Merge in wide curses code done as a Summer of Code project by Ruibiao Qiu.
|
1.31 |
| 21-Jan-2007 |
jdc | Add debug "areas" that allow selective debugging by setting the "CURSES_TRACE_MASK" environment variable. Postive vales include debug areas, negative values exclude them.
|
1.30 |
| 15-Jan-2006 |
jdc | branches: 1.30.6; Background characters and attributes don't need to be kept per character cell, as they are merged when characters are added. Remove the per cell storage and clarify the manual page. Pointed out by ruibiao@.
|
1.29 |
| 10-Aug-2003 |
dsl | Revert most of rev 1.27 of addbytes.c and associated changes. Posix requires that adding '\n' does clrtoeol() and 'x = 0'. (Making "\r\n" erase the text that has just been displayed.) Remove __NONL test from addbytes, __NONL is a property of the output device.
|
1.28 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
|
1.27 |
| 31-Jul-2003 |
dsl | Do something more sensible for waddbytes(..., "\r\n", ...); I'm not sure about the clrtoeol() at all though - maybe it should be done as part of scroll()? Leave 'x' alone when __NONL set.
|
1.26 |
| 26-Jun-2003 |
dsl | Stop blank line being added when newline is processed with __ISPASTEOL set.
|
1.25 |
| 17-Feb-2003 |
dsl | Fix resize of windows with subwins. Let window size be given as a -ver number => lines from bottom. Fix trace calls of pointers (approved by Brett Lumn)
|
1.24 |
| 23-Dec-2002 |
jdc | Always update the change pointers. Otherwise, we could end up not displaying 'blank' characters when overlapping windows are displayed. (Exposed by changes in revision 1.49 of refresh.c.)
|
1.23 |
| 19-Jul-2002 |
blymn | * Added new function idcok - this closes PR 10802 * Added sentinels to the line structures when in debug mode to try to pick up data overwrite problems, if they occur.
|
1.22 |
| 20-Apr-2001 |
jdc | Implement scrolling regions : has_ic() has_il() setscrreg() wsetscrreg()
|
1.21 |
| 19-Dec-2000 |
jdc | Rename variables refering to termcap capabilities from NN to __tc_nn. Case adjusted to match termcap capability. A few other variable names renamed too (ones related to or derived from termcap variables).
|
1.20 |
| 28-Apr-2000 |
mycroft | Massively simplify some logic.
|
1.19 |
| 18-Apr-2000 |
jdc | Set background character and attributes for added characters.
|
1.18 |
| 15-Apr-2000 |
jdc | Don't reset firstchp and lastchp even if this line was not dirty. They could have been set previously by a parent window or sub-window.
|
1.17 |
| 15-Apr-2000 |
blymn | Added functions to replace what were previously macros in curses.h (this is a requirement of SUSv2) - the old macro behaviour can be restored by defining _CURSES_USE_MACROS. Changed function prototypes to use ANSI style. All externally visible functions now have ANSI style declarations.
|
1.16 |
| 12-Apr-2000 |
jdc | Add color attribute manipulation.
|
1.15 |
| 11-Apr-2000 |
blymn | Made data structures opaque
|
1.14 |
| 28-Jun-1999 |
simonb | branches: 1.14.6; Get rid of the evil trailing spaces and tabs.
|
1.13 |
| 13-Apr-1999 |
mrg | Upgrades the standard NetBSD curses library to provide some of the SYSV curses facilities. The added features are the collapsing of arrow and function keysequences (as defined by termcap for the terminal) into symbolic code returns thus relieving the application of recognising multi-character key sequences. Other features are the capability to perform a timed wait for a key (good for when you are not sure if there is a keypress ready or not) and the capability for turning off the inter-key timeout when assembling multi-character function keys.
this work was done by Julian Coleman <J.D.Coleman@newcastle.ac.uk> and blymn@baea.com.au (Brett Lymn). i'm just integrating it. thanks HEAPS guys!
|
1.12 |
| 03-Feb-1998 |
perry | remove obsolete register declarations
|
1.11 |
| 22-Jul-1997 |
mikel | RCSid police, fix warnings
|
1.10 |
| 17-Aug-1994 |
cgd | branches: 1.10.2; clean up import
|
1.9 |
| 24-Jan-1994 |
cgd | changes from branch
|
1.8 |
| 09-Nov-1993 |
cgd | repeat after me: "I hate rcs ids"
|
1.7 |
| 09-Nov-1993 |
cgd | branches: 1.7.2; update to new version from berkeley. doesn't compile yet, nor does it have rcsid's. this is for diffs.
|
1.6 |
| 15-Aug-1993 |
mycroft | waddbytes() is private; make the rest of *addbytes() be. Make waddbytes() and waddstr() take a `const char *'.
|
1.5 |
| 07-Aug-1993 |
mycroft | New version from uunet.
|
1.4 |
| 01-Aug-1993 |
mycroft | Add RCS identifiers.
|
1.3 |
| 09-Jul-1993 |
alm | added Andrew Chernov's patch set: Standard curses library use eight bit for standout mode, so 8-bit characters displays like highlighted 7-bit characters.
This patch produce library which is fully compatible with all curses programs and add 8-bit chars to all input/display functions. --- I don't think, that any programs wish to use internal curses attribute _STANDOUT directly, in expressions like: addch( ch | _STANDOUT ); Normal interface use standout() and standend() functions instead. Many programs use 'char' type (with sign extention) for input characters and sign extention becomes _STANDOUT mode in this case. So, I refuse this future and allow 8-bit characters for programs, which is designed for 7-bit only ('char' type using instead of 'unsigned char'). --- This small patch fix unpleasant standard curses bug: curses can't expand TAB at all (but tries). A man who wrote this curses misplace SYNC_IN and SYNCH_OUT, this patch exchange macro calls.
This patch useful for standard 7-bit curses too, for this you must delete '_' symbol before waddbytes and apply patch. --- Oh, NO! This curses are really buggy!
This small patch fix following problem: [ assumed scrollok(stdscr, TRUE) ] when addch(ch) at lower right corner of screen, curses are realy gone mad instead if simple scrolling... Curses code assumed that this will be done correctly, but implement it with two bugs.
|
1.2 |
| 23-Apr-1993 |
mycroft | Make tabs actually work.
|
1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.2 |
| 17-Aug-1994 |
cgd | new libcurses, from new nvi
|
1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.7.2.1 |
| 24-Jan-1994 |
cgd | minor fixups
|
1.10.2.2 |
| 17-Aug-1994 |
cgd | clean up import
|
1.10.2.1 |
| 17-Aug-1994 |
cgd | file addbytes.c was added on branch netbsd-1-0 on 1994-08-17 21:51:44 +0000
|
1.14.6.2 |
| 05-Mar-2000 |
jdc | Add alternate character set support.
|
1.14.6.1 |
| 09-Jan-2000 |
jdc | Changes to make libcurses SUS v2 compatible.
|
1.30.6.7 |
| 18-Mar-2007 |
jdc | Mark subsequent cells of multi-column characters with __WCWIDTH and their attributes and only display them once.
|
1.30.6.6 |
| 26-Feb-2007 |
blymn | * commonalise adding a wide character so it can be reused * make __waddbytes add wide characters if libcurses is built in wide character mode. * make waddch add wide characters if libcurses is built in wide character mode.
|
1.30.6.5 |
| 22-Jan-2007 |
jdc | We only need to include <assert.h> when debugging.
|
1.30.6.4 |
| 22-Jan-2007 |
blymn | * Make WCHAR libcurses the default build * Sprinkle about some SET_WCOL() calls where they were missing
|
1.30.6.3 |
| 22-Jan-2007 |
jdc | We only need to include <assert.h> when debugging.
|
1.30.6.2 |
| 21-Jan-2007 |
jdc | Apply the changes that add debug "areas" on HEAD to the wcurses branch. Add correspending changes to the debug code that is only present on the branch.
|
1.30.6.1 |
| 21-Jan-2007 |
blymn | Wide curses merge
|
1.32.4.1 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.33.8.1 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.39.8.1 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.39.2.1 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.42.8.2 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.42.8.1 |
| 04-Nov-2016 |
pgoyette | Sync with HEAD
|
1.42.4.1 |
| 09-Aug-2018 |
martin | Pull up following revision(s) (requested by simonb in ticket #1627):
lib/libcurses/addbytes.c: revision 1.48
Avoid curx going beyond end of window when adding a wide character to the last column.
OK @blymn.
|
1.47.14.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.47.12.2 |
| 26-Nov-2018 |
pgoyette | Sync with HEAD, resolve a couple of conflicts
|
1.47.12.1 |
| 06-Sep-2018 |
pgoyette | Sync with HEAD
Resolve a couple of conflicts (result of the uimin/uimax changes)
|
1.47.6.1 |
| 08-Aug-2018 |
martin | Pull up following revision(s) (requested by simonb in ticket #964):
lib/libcurses/addbytes.c: revision 1.48
Avoid curx going beyond end of window when adding a wide character to the last column.
OK @blymn. - --
|
1.54.4.1 |
| 06-Jun-2021 |
cjep | sync with head
|
1.67.2.2 |
| 10-Oct-2023 |
martin | Pull up following revision(s) (requested by kim in ticket #402):
tests/lib/libcurses/check_files/waddstr2.chk: revision 1.2 tests/lib/libcurses/check_files/addstr3.chk: revision 1.5 lib/libcurses/addbytes.c: revision 1.69 lib/libcurses/tty.c: revision 1.50
Fix for install/56467
Set x to 0 before calling scroll based on a proposed fix by RVP (thanks!) Update check files affected by a fix to addbyte.c in libcurses.
Correct the fd closed check so we actually check the outfd as per the comment. Thanks for jdc%netbsd.org@localhost for catching this one.
|
1.67.2.1 |
| 21-Dec-2022 |
martin | Pull up following revision(s) (requested by blymn in ticket #15):
lib/libcurses/slk.c: revision 1.21 lib/libcurses/addbytes.c: revision 1.68
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.
|
1.69.2.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|