Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Utilities/cmpdcurses/pdcurses/delch.c
3153 views
1
/* PDCurses */
2
3
#include <curspriv.h>
4
5
/*man-start**************************************************************
6
7
delch
8
-----
9
10
### Synopsis
11
12
int delch(void);
13
int wdelch(WINDOW *win);
14
int mvdelch(int y, int x);
15
int mvwdelch(WINDOW *win, int y, int x);
16
17
### Description
18
19
The character under the cursor in the window is deleted. All
20
characters to the right on the same line are moved to the left one
21
position and the last character on the line is filled with a blank.
22
The cursor position does not change (after moving to y, x if
23
coordinates are specified).
24
25
### Return Value
26
27
All functions return OK on success and ERR on error.
28
29
### Portability
30
X/Open ncurses NetBSD
31
delch Y Y Y
32
wdelch Y Y Y
33
mvdelch Y Y Y
34
mvwdelch Y Y Y
35
36
**man-end****************************************************************/
37
38
#include <string.h>
39
40
int wdelch(WINDOW *win)
41
{
42
int y, x, maxx;
43
chtype *temp1;
44
45
PDC_LOG(("wdelch() - called\n"));
46
47
if (!win)
48
return ERR;
49
50
y = win->_cury;
51
x = win->_curx;
52
maxx = win->_maxx - 1;
53
temp1 = &win->_y[y][x];
54
55
memmove(temp1, temp1 + 1, (maxx - x) * sizeof(chtype));
56
57
/* wrs (4/10/93) account for window background */
58
59
win->_y[y][maxx] = win->_bkgd;
60
61
win->_lastch[y] = maxx;
62
63
if ((win->_firstch[y] == _NO_CHANGE) || (win->_firstch[y] > x))
64
win->_firstch[y] = x;
65
66
PDC_sync(win);
67
68
return OK;
69
}
70
71
int delch(void)
72
{
73
PDC_LOG(("delch() - called\n"));
74
75
return wdelch(stdscr);
76
}
77
78
int mvdelch(int y, int x)
79
{
80
PDC_LOG(("mvdelch() - called\n"));
81
82
if (move(y, x) == ERR)
83
return ERR;
84
85
return wdelch(stdscr);
86
}
87
88
int mvwdelch(WINDOW *win, int y, int x)
89
{
90
PDC_LOG(("mvwdelch() - called\n"));
91
92
if (wmove(win, y, x) == ERR)
93
return ERR;
94
95
return wdelch(win);
96
}
97
98