3 ** This module contains functions specific to command window processing.
14 /*****************************************
15 ** STATIC LOCAL FUNCTIONS FORWARD DECLS **
16 ******************************************/
20 /*****************************************
21 ** PUBLIC FUNCTIONS **
22 ******************************************/
25 ** tuiDispatchCtrlChar().
26 ** Dispatch the correct tui function based upon the control character.
33 tuiDispatchCtrlChar (ch)
37 TuiWinInfoPtr winInfo = tuiWinWithFocus ();
40 ** If the command window has the logical focus, or no-one does
41 ** assume it is the command window; in this case, pass the
42 ** character on through and do nothing here.
44 if (winInfo == (TuiWinInfoPtr) NULL || winInfo == cmdWin)
48 unsigned int c = 0, chCopy = ch;
52 /* If this is an xterm, page next/prev keys aren't returned
53 ** by keypad as a single char, so we must handle them here.
54 ** Seems like a bug in the curses library?
56 term = (char *) getenv ("TERM");
57 for (i = 0; (term && term[i]); i++)
58 term[i] = toupper (term[i]);
59 if ((strcmp (term, "XTERM") == 0) && m_isStartSequence (ch))
61 unsigned int pageCh = 0, tmpChar;
64 while (!m_isEndSequence (tmpChar))
66 tmpChar = (int) wgetch (cmdWin->generic.handle);
71 else if (tmpChar == 54)
80 tuiScrollForward (winInfo, 0);
83 tuiScrollBackward (winInfo, 0);
87 tuiScrollForward (winInfo, 1);
91 tuiScrollBackward (winInfo, 1);
94 tuiScrollLeft (winInfo, 1);
97 tuiScrollRight (winInfo, 1);
108 } /* tuiDispatchCtrlChar */
112 ** tuiIncrCommandCharCountBy()
113 ** Increment the current character count in the command window,
114 ** checking for overflow. Returns the new value of the char count.
118 tuiIncrCommandCharCountBy (
121 tuiIncrCommandCharCountBy (count)
127 if ((count + cmdWin->detail.commandInfo.curch) >= cmdWin->generic.width)
128 cmdWin->detail.commandInfo.curch =
129 (count + cmdWin->detail.commandInfo.curch) - cmdWin->generic.width;
131 cmdWin->detail.commandInfo.curch += count;
134 return cmdWin->detail.commandInfo.curch;
135 } /* tuiIncrCommandCharCountBy */
139 ** tuiDecrCommandCharCountBy()
140 ** Decrement the current character count in the command window,
141 ** checking for overflow. Returns the new value of the char count.
145 tuiDecrCommandCharCountBy (
148 tuiDecrCommandCharCountBy (count)
154 if ((cmdWin->detail.commandInfo.curch - count) < 0)
155 cmdWin->detail.commandInfo.curch =
156 cmdWin->generic.width + (cmdWin->detail.commandInfo.curch - count);
158 cmdWin->detail.commandInfo.curch -= count;
161 return cmdWin->detail.commandInfo.curch;
162 } /* tuiDecrCommandCharCountBy */
166 ** tuiSetCommandCharCountTo()
167 ** Set the character count to count.
171 tuiSetCommandCharCountTo (
174 tuiSetCommandCharCountTo (count)
180 if (count > cmdWin->generic.width - 1)
182 cmdWin->detail.commandInfo.curch = 0;
183 tuiIncrCommandCharCountBy (count);
186 cmdWin->detail.commandInfo.curch -= count;
189 return cmdWin->detail.commandInfo.curch;
190 } /* tuiSetCommandCharCountTo */
195 ** tuiClearCommandCharCount()
196 ** Clear the character count to count.
200 tuiClearCommandCharCount (void)
202 tuiClearCommandCharCount ()
206 cmdWin->detail.commandInfo.curch = 0;
208 return cmdWin->detail.commandInfo.curch;
209 } /* tuiClearCommandCharCount */
213 /*****************************************
214 ** STATIC LOCAL FUNCTIONS **
215 ******************************************/