Merge lp:~g-bluehut/ubuntu-terminal-app/whitespacefix into lp:ubuntu-terminal-app
- whitespacefix
- Merge into trunk
Proposed by
Michael Vetter
Status: | Merged |
---|---|
Approved by: | Alan Pope 🍺🐧🐱 🦄 |
Approved revision: | 102 |
Merged at revision: | 103 |
Proposed branch: | lp:~g-bluehut/ubuntu-terminal-app/whitespacefix |
Merge into: | lp:ubuntu-terminal-app |
Diff against target: |
5534 lines (+928/-928) 24 files modified
src/plugin/konsole/Character.h (+23/-23) src/plugin/konsole/CharacterColor.h (+49/-49) src/plugin/konsole/ColorScheme.cpp (+46/-46) src/plugin/konsole/ColorScheme.h (+32/-32) src/plugin/konsole/Emulation.cpp (+23/-23) src/plugin/konsole/Emulation.h (+93/-93) src/plugin/konsole/Filter.cpp (+19/-19) src/plugin/konsole/Filter.h (+44/-44) src/plugin/konsole/History.cpp (+34/-34) src/plugin/konsole/History.h (+14/-14) src/plugin/konsole/KeyboardTranslator.cpp (+32/-32) src/plugin/konsole/KeyboardTranslator.h (+72/-72) src/plugin/konsole/Pty.cpp (+16/-16) src/plugin/konsole/Pty.h (+32/-32) src/plugin/konsole/Screen.cpp (+60/-60) src/plugin/konsole/Screen.h (+132/-132) src/plugin/konsole/ScreenWindow.cpp (+17/-17) src/plugin/konsole/ScreenWindow.h (+25/-25) src/plugin/konsole/TerminalCharacterDecoder.cpp (+16/-16) src/plugin/konsole/TerminalCharacterDecoder.h (+16/-16) src/plugin/konsole/Vt102Emulation.cpp (+112/-112) src/plugin/konsole/Vt102Emulation.h (+19/-19) src/plugin/konsole/kprocess.h (+1/-1) src/plugin/konsole/ksession.h (+1/-1) |
To merge this branch: | bzr merge lp:~g-bluehut/ubuntu-terminal-app/whitespacefix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
David Planella | Approve | ||
Review via email: mp+228807@code.launchpad.net |
Commit message
Fix superfluous trailing whitespace
Description of the change
To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:102
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/plugin/konsole/Character.h' | |||
2 | --- src/plugin/konsole/Character.h 2014-04-27 09:11:14 +0000 | |||
3 | +++ src/plugin/konsole/Character.h 2014-07-30 09:50:10 +0000 | |||
4 | @@ -1,6 +1,6 @@ | |||
5 | 1 | /* | 1 | /* |
6 | 2 | This file is part of Konsole, KDE's terminal. | 2 | This file is part of Konsole, KDE's terminal. |
8 | 3 | 3 | ||
9 | 4 | Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> | 4 | Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> |
10 | 5 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> | 5 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> |
11 | 6 | 6 | ||
12 | @@ -53,7 +53,7 @@ | |||
13 | 53 | class Character | 53 | class Character |
14 | 54 | { | 54 | { |
15 | 55 | public: | 55 | public: |
17 | 56 | /** | 56 | /** |
18 | 57 | * Constructs a new character. | 57 | * Constructs a new character. |
19 | 58 | * | 58 | * |
20 | 59 | * @param _c The unicode character value of this character. | 59 | * @param _c The unicode character value of this character. |
21 | @@ -71,25 +71,25 @@ | |||
22 | 71 | { | 71 | { |
23 | 72 | /** The unicode character value for this character. */ | 72 | /** The unicode character value for this character. */ |
24 | 73 | quint16 character; | 73 | quint16 character; |
26 | 74 | /** | 74 | /** |
27 | 75 | * Experimental addition which allows a single Character instance to contain more than | 75 | * Experimental addition which allows a single Character instance to contain more than |
28 | 76 | * one unicode character. | 76 | * one unicode character. |
29 | 77 | * | 77 | * |
30 | 78 | * charSequence is a hash code which can be used to look up the unicode | 78 | * charSequence is a hash code which can be used to look up the unicode |
31 | 79 | * character sequence in the ExtendedCharTable used to create the sequence. | 79 | * character sequence in the ExtendedCharTable used to create the sequence. |
32 | 80 | */ | 80 | */ |
34 | 81 | quint16 charSequence; | 81 | quint16 charSequence; |
35 | 82 | }; | 82 | }; |
36 | 83 | 83 | ||
37 | 84 | /** A combination of RENDITION flags which specify options for drawing the character. */ | 84 | /** A combination of RENDITION flags which specify options for drawing the character. */ |
38 | 85 | quint8 rendition; | 85 | quint8 rendition; |
39 | 86 | 86 | ||
40 | 87 | /** The foreground color used to draw this character. */ | 87 | /** The foreground color used to draw this character. */ |
42 | 88 | CharacterColor foregroundColor; | 88 | CharacterColor foregroundColor; |
43 | 89 | /** The color used to draw this character's background. */ | 89 | /** The color used to draw this character's background. */ |
44 | 90 | CharacterColor backgroundColor; | 90 | CharacterColor backgroundColor; |
45 | 91 | 91 | ||
47 | 92 | /** | 92 | /** |
48 | 93 | * Returns true if this character has a transparent background when | 93 | * Returns true if this character has a transparent background when |
49 | 94 | * it is drawn with the specified @p palette. | 94 | * it is drawn with the specified @p palette. |
50 | 95 | */ | 95 | */ |
51 | @@ -97,16 +97,16 @@ | |||
52 | 97 | /** | 97 | /** |
53 | 98 | * Returns true if this character should always be drawn in bold when | 98 | * Returns true if this character should always be drawn in bold when |
54 | 99 | * it is drawn with the specified @p palette, independent of whether | 99 | * it is drawn with the specified @p palette, independent of whether |
56 | 100 | * or not the character has the RE_BOLD rendition flag. | 100 | * or not the character has the RE_BOLD rendition flag. |
57 | 101 | */ | 101 | */ |
58 | 102 | ColorEntry::FontWeight fontWeight(const ColorEntry* base) const; | 102 | ColorEntry::FontWeight fontWeight(const ColorEntry* base) const; |
61 | 103 | 103 | ||
62 | 104 | /** | 104 | /** |
63 | 105 | * returns true if the format (color, rendition flag) of the compared characters is equal | 105 | * returns true if the format (color, rendition flag) of the compared characters is equal |
64 | 106 | */ | 106 | */ |
65 | 107 | bool equalsFormat(const Character &other) const; | 107 | bool equalsFormat(const Character &other) const; |
66 | 108 | 108 | ||
68 | 109 | /** | 109 | /** |
69 | 110 | * Compares two characters and returns true if they have the same unicode character value, | 110 | * Compares two characters and returns true if they have the same unicode character value, |
70 | 111 | * rendition and colors. | 111 | * rendition and colors. |
71 | 112 | */ | 112 | */ |
72 | @@ -119,36 +119,36 @@ | |||
73 | 119 | }; | 119 | }; |
74 | 120 | 120 | ||
75 | 121 | inline bool operator == (const Character& a, const Character& b) | 121 | inline bool operator == (const Character& a, const Character& b) |
80 | 122 | { | 122 | { |
81 | 123 | return a.character == b.character && | 123 | return a.character == b.character && |
82 | 124 | a.rendition == b.rendition && | 124 | a.rendition == b.rendition && |
83 | 125 | a.foregroundColor == b.foregroundColor && | 125 | a.foregroundColor == b.foregroundColor && |
84 | 126 | a.backgroundColor == b.backgroundColor; | 126 | a.backgroundColor == b.backgroundColor; |
85 | 127 | } | 127 | } |
86 | 128 | 128 | ||
87 | 129 | inline bool operator != (const Character& a, const Character& b) | 129 | inline bool operator != (const Character& a, const Character& b) |
88 | 130 | { | 130 | { |
92 | 131 | return a.character != b.character || | 131 | return a.character != b.character || |
93 | 132 | a.rendition != b.rendition || | 132 | a.rendition != b.rendition || |
94 | 133 | a.foregroundColor != b.foregroundColor || | 133 | a.foregroundColor != b.foregroundColor || |
95 | 134 | a.backgroundColor != b.backgroundColor; | 134 | a.backgroundColor != b.backgroundColor; |
96 | 135 | } | 135 | } |
97 | 136 | 136 | ||
98 | 137 | inline bool Character::isTransparent(const ColorEntry* base) const | 137 | inline bool Character::isTransparent(const ColorEntry* base) const |
99 | 138 | { | 138 | { |
101 | 139 | return ((backgroundColor._colorSpace == COLOR_SPACE_DEFAULT) && | 139 | return ((backgroundColor._colorSpace == COLOR_SPACE_DEFAULT) && |
102 | 140 | base[backgroundColor._u+0+(backgroundColor._v?BASE_COLORS:0)].transparent) | 140 | base[backgroundColor._u+0+(backgroundColor._v?BASE_COLORS:0)].transparent) |
104 | 141 | || ((backgroundColor._colorSpace == COLOR_SPACE_SYSTEM) && | 141 | || ((backgroundColor._colorSpace == COLOR_SPACE_SYSTEM) && |
105 | 142 | base[backgroundColor._u+2+(backgroundColor._v?BASE_COLORS:0)].transparent); | 142 | base[backgroundColor._u+2+(backgroundColor._v?BASE_COLORS:0)].transparent); |
106 | 143 | } | 143 | } |
107 | 144 | 144 | ||
108 | 145 | inline bool Character::equalsFormat(const Character& other) const | 145 | inline bool Character::equalsFormat(const Character& other) const |
109 | 146 | { | 146 | { |
111 | 147 | return | 147 | return |
112 | 148 | backgroundColor==other.backgroundColor && | 148 | backgroundColor==other.backgroundColor && |
113 | 149 | foregroundColor==other.foregroundColor && | 149 | foregroundColor==other.foregroundColor && |
114 | 150 | rendition==other.rendition; | 150 | rendition==other.rendition; |
116 | 151 | } | 151 | } |
117 | 152 | 152 | ||
118 | 153 | inline ColorEntry::FontWeight Character::fontWeight(const ColorEntry* base) const | 153 | inline ColorEntry::FontWeight Character::fontWeight(const ColorEntry* base) const |
119 | 154 | { | 154 | { |
120 | @@ -193,7 +193,7 @@ | |||
121 | 193 | * which was added to the table using createExtendedChar(). | 193 | * which was added to the table using createExtendedChar(). |
122 | 194 | * | 194 | * |
123 | 195 | * @param hash The hash key returned by createExtendedChar() | 195 | * @param hash The hash key returned by createExtendedChar() |
125 | 196 | * @param length This variable is set to the length of the | 196 | * @param length This variable is set to the length of the |
126 | 197 | * character sequence. | 197 | * character sequence. |
127 | 198 | * | 198 | * |
128 | 199 | * @return A unicode character sequence of size @p length. | 199 | * @return A unicode character sequence of size @p length. |
129 | @@ -205,7 +205,7 @@ | |||
130 | 205 | private: | 205 | private: |
131 | 206 | // calculates the hash key of a sequence of unicode points of size 'length' | 206 | // calculates the hash key of a sequence of unicode points of size 'length' |
132 | 207 | ushort extendedCharHash(ushort* unicodePoints , ushort length) const; | 207 | ushort extendedCharHash(ushort* unicodePoints , ushort length) const; |
134 | 208 | // tests whether the entry in the table specified by 'hash' matches the | 208 | // tests whether the entry in the table specified by 'hash' matches the |
135 | 209 | // character sequence 'unicodePoints' of size 'length' | 209 | // character sequence 'unicodePoints' of size 'length' |
136 | 210 | bool extendedCharMatch(ushort hash , ushort* unicodePoints , ushort length) const; | 210 | bool extendedCharMatch(ushort hash , ushort* unicodePoints , ushort length) const; |
137 | 211 | // internal, maps hash keys to character sequence buffers. The first ushort | 211 | // internal, maps hash keys to character sequence buffers. The first ushort |
138 | 212 | 212 | ||
139 | === modified file 'src/plugin/konsole/CharacterColor.h' | |||
140 | --- src/plugin/konsole/CharacterColor.h 2014-04-27 09:11:14 +0000 | |||
141 | +++ src/plugin/konsole/CharacterColor.h 2014-07-30 09:50:10 +0000 | |||
142 | @@ -1,6 +1,6 @@ | |||
143 | 1 | /* | 1 | /* |
144 | 2 | This file is part of Konsole, KDE's terminal. | 2 | This file is part of Konsole, KDE's terminal. |
146 | 3 | 3 | ||
147 | 4 | Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> | 4 | Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> |
148 | 5 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> | 5 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> |
149 | 6 | 6 | ||
150 | @@ -29,14 +29,14 @@ | |||
151 | 29 | //#include <kdemacros.h> | 29 | //#include <kdemacros.h> |
152 | 30 | #define KDE_NO_EXPORT | 30 | #define KDE_NO_EXPORT |
153 | 31 | 31 | ||
156 | 32 | /** | 32 | /** |
157 | 33 | * An entry in a terminal display's color palette. | 33 | * An entry in a terminal display's color palette. |
158 | 34 | * | 34 | * |
159 | 35 | * A color palette is an array of 16 ColorEntry instances which map | 35 | * A color palette is an array of 16 ColorEntry instances which map |
160 | 36 | * system color indexes (from 0 to 15) into actual colors. | 36 | * system color indexes (from 0 to 15) into actual colors. |
161 | 37 | * | 37 | * |
162 | 38 | * Each entry can be set as bold, in which case any text | 38 | * Each entry can be set as bold, in which case any text |
164 | 39 | * drawn using the color should be drawn in bold. | 39 | * drawn using the color should be drawn in bold. |
165 | 40 | * | 40 | * |
166 | 41 | * Each entry can also be transparent, in which case the terminal | 41 | * Each entry can also be transparent, in which case the terminal |
167 | 42 | * display should avoid drawing the background for any characters | 42 | * display should avoid drawing the background for any characters |
168 | @@ -46,58 +46,58 @@ | |||
169 | 46 | { | 46 | { |
170 | 47 | public: | 47 | public: |
171 | 48 | /** Specifies the weight to use when drawing text with this color. */ | 48 | /** Specifies the weight to use when drawing text with this color. */ |
173 | 49 | enum FontWeight | 49 | enum FontWeight |
174 | 50 | { | 50 | { |
175 | 51 | /** Always draw text in this color with a bold weight. */ | 51 | /** Always draw text in this color with a bold weight. */ |
176 | 52 | Bold, | 52 | Bold, |
177 | 53 | /** Always draw text in this color with a normal weight. */ | 53 | /** Always draw text in this color with a normal weight. */ |
178 | 54 | Normal, | 54 | Normal, |
181 | 55 | /** | 55 | /** |
182 | 56 | * Use the current font weight set by the terminal application. | 56 | * Use the current font weight set by the terminal application. |
183 | 57 | * This is the default behavior. | 57 | * This is the default behavior. |
184 | 58 | */ | 58 | */ |
185 | 59 | UseCurrentFormat | 59 | UseCurrentFormat |
186 | 60 | }; | 60 | }; |
187 | 61 | 61 | ||
189 | 62 | /** | 62 | /** |
190 | 63 | * Constructs a new color palette entry. | 63 | * Constructs a new color palette entry. |
191 | 64 | * | 64 | * |
192 | 65 | * @param c The color value for this entry. | 65 | * @param c The color value for this entry. |
193 | 66 | * @param tr Specifies that the color should be transparent when used as a background color. | 66 | * @param tr Specifies that the color should be transparent when used as a background color. |
195 | 67 | * @param weight Specifies the font weight to use when drawing text with this color. | 67 | * @param weight Specifies the font weight to use when drawing text with this color. |
196 | 68 | */ | 68 | */ |
198 | 69 | ColorEntry(QColor c, bool tr, FontWeight weight = UseCurrentFormat) | 69 | ColorEntry(QColor c, bool tr, FontWeight weight = UseCurrentFormat) |
199 | 70 | : color(c), transparent(tr), fontWeight(weight) {} | 70 | : color(c), transparent(tr), fontWeight(weight) {} |
200 | 71 | 71 | ||
201 | 72 | /** | 72 | /** |
202 | 73 | * Constructs a new color palette entry with an undefined color, and | 73 | * Constructs a new color palette entry with an undefined color, and |
203 | 74 | * with the transparent and bold flags set to false. | 74 | * with the transparent and bold flags set to false. |
207 | 75 | */ | 75 | */ |
208 | 76 | ColorEntry() : transparent(false), fontWeight(UseCurrentFormat) {} | 76 | ColorEntry() : transparent(false), fontWeight(UseCurrentFormat) {} |
209 | 77 | 77 | ||
210 | 78 | /** | 78 | /** |
211 | 79 | * Sets the color, transparency and boldness of this color to those of @p rhs. | 79 | * Sets the color, transparency and boldness of this color to those of @p rhs. |
218 | 80 | */ | 80 | */ |
219 | 81 | void operator=(const ColorEntry& rhs) | 81 | void operator=(const ColorEntry& rhs) |
220 | 82 | { | 82 | { |
221 | 83 | color = rhs.color; | 83 | color = rhs.color; |
222 | 84 | transparent = rhs.transparent; | 84 | transparent = rhs.transparent; |
223 | 85 | fontWeight = rhs.fontWeight; | 85 | fontWeight = rhs.fontWeight; |
224 | 86 | } | 86 | } |
225 | 87 | 87 | ||
226 | 88 | /** The color value of this entry for display. */ | 88 | /** The color value of this entry for display. */ |
227 | 89 | QColor color; | 89 | QColor color; |
228 | 90 | 90 | ||
231 | 91 | /** | 91 | /** |
232 | 92 | * If true character backgrounds using this color should be transparent. | 92 | * If true character backgrounds using this color should be transparent. |
233 | 93 | * This is not applicable when the color is used to render text. | 93 | * This is not applicable when the color is used to render text. |
234 | 94 | */ | 94 | */ |
235 | 95 | bool transparent; | 95 | bool transparent; |
236 | 96 | /** | 96 | /** |
238 | 97 | * Specifies the font weight to use when drawing text with this color. | 97 | * Specifies the font weight to use when drawing text with this color. |
239 | 98 | * This is not applicable when the color is used to draw a character's background. | 98 | * This is not applicable when the color is used to draw a character's background. |
240 | 99 | */ | 99 | */ |
242 | 100 | FontWeight fontWeight; | 100 | FontWeight fontWeight; |
243 | 101 | }; | 101 | }; |
244 | 102 | 102 | ||
245 | 103 | 103 | ||
246 | @@ -148,15 +148,15 @@ | |||
247 | 148 | 148 | ||
248 | 149 | public: | 149 | public: |
249 | 150 | /** Constructs a new CharacterColor whoose color and color space are undefined. */ | 150 | /** Constructs a new CharacterColor whoose color and color space are undefined. */ |
255 | 151 | CharacterColor() | 151 | CharacterColor() |
256 | 152 | : _colorSpace(COLOR_SPACE_UNDEFINED), | 152 | : _colorSpace(COLOR_SPACE_UNDEFINED), |
257 | 153 | _u(0), | 153 | _u(0), |
258 | 154 | _v(0), | 154 | _v(0), |
259 | 155 | _w(0) | 155 | _w(0) |
260 | 156 | {} | 156 | {} |
261 | 157 | 157 | ||
264 | 158 | /** | 158 | /** |
265 | 159 | * Constructs a new CharacterColor using the specified @p colorSpace and with | 159 | * Constructs a new CharacterColor using the specified @p colorSpace and with |
266 | 160 | * color value @p co | 160 | * color value @p co |
267 | 161 | * | 161 | * |
268 | 162 | * The meaning of @p co depends on the @p colorSpace used. | 162 | * The meaning of @p co depends on the @p colorSpace used. |
269 | @@ -165,10 +165,10 @@ | |||
270 | 165 | * | 165 | * |
271 | 166 | * TODO : Add documentation about available color spaces. | 166 | * TODO : Add documentation about available color spaces. |
272 | 167 | */ | 167 | */ |
277 | 168 | CharacterColor(quint8 colorSpace, int co) | 168 | CharacterColor(quint8 colorSpace, int co) |
278 | 169 | : _colorSpace(colorSpace), | 169 | : _colorSpace(colorSpace), |
279 | 170 | _u(0), | 170 | _u(0), |
280 | 171 | _v(0), | 171 | _v(0), |
281 | 172 | _w(0) | 172 | _w(0) |
282 | 173 | { | 173 | { |
283 | 174 | switch (colorSpace) | 174 | switch (colorSpace) |
284 | @@ -180,7 +180,7 @@ | |||
285 | 180 | _u = co & 7; | 180 | _u = co & 7; |
286 | 181 | _v = (co >> 3) & 1; | 181 | _v = (co >> 3) & 1; |
287 | 182 | break; | 182 | break; |
289 | 183 | case COLOR_SPACE_256: | 183 | case COLOR_SPACE_256: |
290 | 184 | _u = co & 255; | 184 | _u = co & 255; |
291 | 185 | break; | 185 | break; |
292 | 186 | case COLOR_SPACE_RGB: | 186 | case COLOR_SPACE_RGB: |
293 | @@ -193,32 +193,32 @@ | |||
294 | 193 | } | 193 | } |
295 | 194 | } | 194 | } |
296 | 195 | 195 | ||
298 | 196 | /** | 196 | /** |
299 | 197 | * Returns true if this character color entry is valid. | 197 | * Returns true if this character color entry is valid. |
300 | 198 | */ | 198 | */ |
302 | 199 | bool isValid() | 199 | bool isValid() |
303 | 200 | { | 200 | { |
304 | 201 | return _colorSpace != COLOR_SPACE_UNDEFINED; | 201 | return _colorSpace != COLOR_SPACE_UNDEFINED; |
305 | 202 | } | 202 | } |
308 | 203 | 203 | ||
309 | 204 | /** | 204 | /** |
310 | 205 | * Toggles the value of this color between a normal system color and the corresponding intensive | 205 | * Toggles the value of this color between a normal system color and the corresponding intensive |
311 | 206 | * system color. | 206 | * system color. |
313 | 207 | * | 207 | * |
314 | 208 | * This is only applicable if the color is using the COLOR_SPACE_DEFAULT or COLOR_SPACE_SYSTEM | 208 | * This is only applicable if the color is using the COLOR_SPACE_DEFAULT or COLOR_SPACE_SYSTEM |
315 | 209 | * color spaces. | 209 | * color spaces. |
316 | 210 | */ | 210 | */ |
317 | 211 | void toggleIntensive(); | 211 | void toggleIntensive(); |
318 | 212 | 212 | ||
320 | 213 | /** | 213 | /** |
321 | 214 | * Returns the color within the specified color @p palette | 214 | * Returns the color within the specified color @p palette |
322 | 215 | * | 215 | * |
323 | 216 | * The @p palette is only used if this color is one of the 16 system colors, otherwise | 216 | * The @p palette is only used if this color is one of the 16 system colors, otherwise |
324 | 217 | * it is ignored. | 217 | * it is ignored. |
325 | 218 | */ | 218 | */ |
326 | 219 | QColor color(const ColorEntry* palette) const; | 219 | QColor color(const ColorEntry* palette) const; |
329 | 220 | 220 | ||
330 | 221 | /** | 221 | /** |
331 | 222 | * Compares two colors and returns true if they represent the same color value and | 222 | * Compares two colors and returns true if they represent the same color value and |
332 | 223 | * use the same color space. | 223 | * use the same color space. |
333 | 224 | */ | 224 | */ |
334 | @@ -232,14 +232,14 @@ | |||
335 | 232 | private: | 232 | private: |
336 | 233 | quint8 _colorSpace; | 233 | quint8 _colorSpace; |
337 | 234 | 234 | ||
342 | 235 | // bytes storing the character color | 235 | // bytes storing the character color |
343 | 236 | quint8 _u; | 236 | quint8 _u; |
344 | 237 | quint8 _v; | 237 | quint8 _v; |
345 | 238 | quint8 _w; | 238 | quint8 _w; |
346 | 239 | }; | 239 | }; |
347 | 240 | 240 | ||
348 | 241 | inline bool operator == (const CharacterColor& a, const CharacterColor& b) | 241 | inline bool operator == (const CharacterColor& a, const CharacterColor& b) |
350 | 242 | { | 242 | { |
351 | 243 | return a._colorSpace == b._colorSpace && | 243 | return a._colorSpace == b._colorSpace && |
352 | 244 | a._u == b._u && | 244 | a._u == b._u && |
353 | 245 | a._v == b._v && | 245 | a._v == b._v && |
354 | @@ -260,7 +260,7 @@ | |||
355 | 260 | if (u < 216) return QColor(((u/36)%6) ? (40*((u/36)%6)+55) : 0, | 260 | if (u < 216) return QColor(((u/36)%6) ? (40*((u/36)%6)+55) : 0, |
356 | 261 | ((u/ 6)%6) ? (40*((u/ 6)%6)+55) : 0, | 261 | ((u/ 6)%6) ? (40*((u/ 6)%6)+55) : 0, |
357 | 262 | ((u/ 1)%6) ? (40*((u/ 1)%6)+55) : 0); u -= 216; | 262 | ((u/ 1)%6) ? (40*((u/ 1)%6)+55) : 0); u -= 216; |
359 | 263 | 263 | ||
360 | 264 | // 232..255: gray, leaving out black and white | 264 | // 232..255: gray, leaving out black and white |
361 | 265 | int gray = u*10+8; return QColor(gray,gray,gray); | 265 | int gray = u*10+8; return QColor(gray,gray,gray); |
362 | 266 | } | 266 | } |
363 | 267 | 267 | ||
364 | === modified file 'src/plugin/konsole/ColorScheme.cpp' | |||
365 | --- src/plugin/konsole/ColorScheme.cpp 2014-04-27 09:11:14 +0000 | |||
366 | +++ src/plugin/konsole/ColorScheme.cpp 2014-07-30 09:50:10 +0000 | |||
367 | @@ -163,15 +163,15 @@ | |||
368 | 163 | { | 163 | { |
369 | 164 | Q_ASSERT( index >= 0 && index < TABLE_COLORS ); | 164 | Q_ASSERT( index >= 0 && index < TABLE_COLORS ); |
370 | 165 | 165 | ||
372 | 166 | if ( !_table ) | 166 | if ( !_table ) |
373 | 167 | { | 167 | { |
374 | 168 | _table = new ColorEntry[TABLE_COLORS]; | 168 | _table = new ColorEntry[TABLE_COLORS]; |
375 | 169 | 169 | ||
376 | 170 | for (int i=0;i<TABLE_COLORS;i++) | 170 | for (int i=0;i<TABLE_COLORS;i++) |
377 | 171 | _table[i] = defaultTable[i]; | 171 | _table[i] = defaultTable[i]; |
378 | 172 | } | 172 | } |
381 | 173 | 173 | ||
382 | 174 | _table[index] = entry; | 174 | _table[index] = entry; |
383 | 175 | } | 175 | } |
384 | 176 | ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const | 176 | ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const |
385 | 177 | { | 177 | { |
386 | @@ -182,19 +182,19 @@ | |||
387 | 182 | 182 | ||
388 | 183 | ColorEntry entry = colorTable()[index]; | 183 | ColorEntry entry = colorTable()[index]; |
389 | 184 | 184 | ||
392 | 185 | if ( randomSeed != 0 && | 185 | if ( randomSeed != 0 && |
393 | 186 | _randomTable != 0 && | 186 | _randomTable != 0 && |
394 | 187 | !_randomTable[index].isNull() ) | 187 | !_randomTable[index].isNull() ) |
395 | 188 | { | 188 | { |
396 | 189 | const RandomizationRange& range = _randomTable[index]; | 189 | const RandomizationRange& range = _randomTable[index]; |
398 | 190 | 190 | ||
399 | 191 | 191 | ||
400 | 192 | int hueDifference = range.hue ? (qrand() % range.hue) - range.hue/2 : 0; | 192 | int hueDifference = range.hue ? (qrand() % range.hue) - range.hue/2 : 0; |
401 | 193 | int saturationDifference = range.saturation ? (qrand() % range.saturation) - range.saturation/2 : 0; | 193 | int saturationDifference = range.saturation ? (qrand() % range.saturation) - range.saturation/2 : 0; |
402 | 194 | int valueDifference = range.value ? (qrand() % range.value) - range.value/2 : 0; | 194 | int valueDifference = range.value ? (qrand() % range.value) - range.value/2 : 0; |
403 | 195 | 195 | ||
404 | 196 | QColor& color = entry.color; | 196 | QColor& color = entry.color; |
406 | 197 | 197 | ||
407 | 198 | int newHue = qAbs( (color.hue() + hueDifference) % MAX_HUE ); | 198 | int newHue = qAbs( (color.hue() + hueDifference) % MAX_HUE ); |
408 | 199 | int newValue = qMin( qAbs(color.value() + valueDifference) , 255 ); | 199 | int newValue = qMin( qAbs(color.value() + valueDifference) , 255 ); |
409 | 200 | int newSaturation = qMin( qAbs(color.saturation() + saturationDifference) , 255 ); | 200 | int newSaturation = qMin( qAbs(color.saturation() + saturationDifference) , 255 ); |
410 | @@ -215,13 +215,13 @@ | |||
411 | 215 | } | 215 | } |
412 | 216 | void ColorScheme::setRandomizedBackgroundColor(bool randomize) | 216 | void ColorScheme::setRandomizedBackgroundColor(bool randomize) |
413 | 217 | { | 217 | { |
415 | 218 | // the hue of the background colour is allowed to be randomly | 218 | // the hue of the background colour is allowed to be randomly |
416 | 219 | // adjusted as much as possible. | 219 | // adjusted as much as possible. |
417 | 220 | // | 220 | // |
418 | 221 | // the value and saturation are left alone to maintain read-ability | 221 | // the value and saturation are left alone to maintain read-ability |
419 | 222 | if ( randomize ) | 222 | if ( randomize ) |
420 | 223 | { | 223 | { |
422 | 224 | setRandomizationRange( 1 /* background color index */ , MAX_HUE , 255 , 0 ); | 224 | setRandomizationRange( 1 /* background color index */ , MAX_HUE , 255 , 0 ); |
423 | 225 | } | 225 | } |
424 | 226 | else | 226 | else |
425 | 227 | { | 227 | { |
426 | @@ -304,7 +304,7 @@ | |||
427 | 304 | 304 | ||
428 | 305 | configGroup.writeEntry("Description",_description); | 305 | configGroup.writeEntry("Description",_description); |
429 | 306 | configGroup.writeEntry("Opacity",_opacity); | 306 | configGroup.writeEntry("Opacity",_opacity); |
431 | 307 | 307 | ||
432 | 308 | for (int i=0 ; i < TABLE_COLORS ; i++) | 308 | for (int i=0 ; i < TABLE_COLORS ; i++) |
433 | 309 | { | 309 | { |
434 | 310 | RandomizationRange random = _randomTable != 0 ? _randomTable[i] : RandomizationRange(); | 310 | RandomizationRange random = _randomTable != 0 ? _randomTable[i] : RandomizationRange(); |
435 | @@ -313,13 +313,13 @@ | |||
436 | 313 | } | 313 | } |
437 | 314 | #endif | 314 | #endif |
438 | 315 | 315 | ||
440 | 316 | QString ColorScheme::colorNameForIndex(int index) | 316 | QString ColorScheme::colorNameForIndex(int index) |
441 | 317 | { | 317 | { |
442 | 318 | Q_ASSERT( index >= 0 && index < TABLE_COLORS ); | 318 | Q_ASSERT( index >= 0 && index < TABLE_COLORS ); |
443 | 319 | 319 | ||
444 | 320 | return QString(colorNames[index]); | 320 | return QString(colorNames[index]); |
445 | 321 | } | 321 | } |
447 | 322 | QString ColorScheme::translatedColorNameForIndex(int index) | 322 | QString ColorScheme::translatedColorNameForIndex(int index) |
448 | 323 | { | 323 | { |
449 | 324 | Q_ASSERT( index >= 0 && index < TABLE_COLORS ); | 324 | Q_ASSERT( index >= 0 && index < TABLE_COLORS ); |
450 | 325 | 325 | ||
451 | @@ -329,7 +329,7 @@ | |||
452 | 329 | void ColorScheme::readColorEntry(QSettings * s , int index) | 329 | void ColorScheme::readColorEntry(QSettings * s , int index) |
453 | 330 | { | 330 | { |
454 | 331 | s->beginGroup(colorNameForIndex(index)); | 331 | s->beginGroup(colorNameForIndex(index)); |
456 | 332 | 332 | ||
457 | 333 | ColorEntry entry; | 333 | ColorEntry entry; |
458 | 334 | 334 | ||
459 | 335 | QStringList rgbList = s->value("Color", QStringList()).toStringList(); | 335 | QStringList rgbList = s->value("Color", QStringList()).toStringList(); |
460 | @@ -342,7 +342,7 @@ | |||
461 | 342 | g = rgbList[1].toInt(); | 342 | g = rgbList[1].toInt(); |
462 | 343 | b = rgbList[2].toInt(); | 343 | b = rgbList[2].toInt(); |
463 | 344 | entry.color = QColor(r, g, b); | 344 | entry.color = QColor(r, g, b); |
465 | 345 | 345 | ||
466 | 346 | entry.transparent = s->value("Transparent",false).toBool(); | 346 | entry.transparent = s->value("Transparent",false).toBool(); |
467 | 347 | 347 | ||
468 | 348 | // Deprecated key from KDE 4.0 which set 'Bold' to true to force | 348 | // Deprecated key from KDE 4.0 which set 'Bold' to true to force |
469 | @@ -361,7 +361,7 @@ | |||
470 | 361 | setColorTableEntry( index , entry ); | 361 | setColorTableEntry( index , entry ); |
471 | 362 | 362 | ||
472 | 363 | if ( hue != 0 || value != 0 || saturation != 0 ) | 363 | if ( hue != 0 || value != 0 || saturation != 0 ) |
474 | 364 | setRandomizationRange( index , hue , saturation , value ); | 364 | setRandomizationRange( index , hue , saturation , value ); |
475 | 365 | 365 | ||
476 | 366 | s->endGroup(); | 366 | s->endGroup(); |
477 | 367 | } | 367 | } |
478 | @@ -378,8 +378,8 @@ | |||
479 | 378 | configGroup.writeEntry("Bold",entry.fontWeight == ColorEntry::Bold); | 378 | configGroup.writeEntry("Bold",entry.fontWeight == ColorEntry::Bold); |
480 | 379 | } | 379 | } |
481 | 380 | 380 | ||
484 | 381 | // record randomization if this color has randomization or | 381 | // record randomization if this color has randomization or |
485 | 382 | // if one of the keys already exists | 382 | // if one of the keys already exists |
486 | 383 | if ( !random.isNull() || configGroup.hasKey("MaxRandomHue") ) | 383 | if ( !random.isNull() || configGroup.hasKey("MaxRandomHue") ) |
487 | 384 | { | 384 | { |
488 | 385 | configGroup.writeEntry("MaxRandomHue",(int)random.hue); | 385 | configGroup.writeEntry("MaxRandomHue",(int)random.hue); |
489 | @@ -389,28 +389,28 @@ | |||
490 | 389 | } | 389 | } |
491 | 390 | #endif | 390 | #endif |
492 | 391 | 391 | ||
494 | 392 | // | 392 | // |
495 | 393 | // Work In Progress - A color scheme for use on KDE setups for users | 393 | // Work In Progress - A color scheme for use on KDE setups for users |
496 | 394 | // with visual disabilities which means that they may have trouble | 394 | // with visual disabilities which means that they may have trouble |
497 | 395 | // reading text with the supplied color schemes. | 395 | // reading text with the supplied color schemes. |
498 | 396 | // | 396 | // |
499 | 397 | // This color scheme uses only the 'safe' colors defined by the | 397 | // This color scheme uses only the 'safe' colors defined by the |
501 | 398 | // KColorScheme class. | 398 | // KColorScheme class. |
502 | 399 | // | 399 | // |
504 | 400 | // A complication this introduces is that each color provided by | 400 | // A complication this introduces is that each color provided by |
505 | 401 | // KColorScheme is defined as a 'background' or 'foreground' color. | 401 | // KColorScheme is defined as a 'background' or 'foreground' color. |
507 | 402 | // Only foreground colors are allowed to be used to render text and | 402 | // Only foreground colors are allowed to be used to render text and |
508 | 403 | // only background colors are allowed to be used for backgrounds. | 403 | // only background colors are allowed to be used for backgrounds. |
509 | 404 | // | 404 | // |
510 | 405 | // The ColorEntry and TerminalDisplay classes do not currently | 405 | // The ColorEntry and TerminalDisplay classes do not currently |
512 | 406 | // support this restriction. | 406 | // support this restriction. |
513 | 407 | // | 407 | // |
514 | 408 | // Requirements: | 408 | // Requirements: |
515 | 409 | // - A color scheme which uses only colors from the KColorScheme class | 409 | // - A color scheme which uses only colors from the KColorScheme class |
517 | 410 | // - Ability to restrict which colors the TerminalDisplay widget | 410 | // - Ability to restrict which colors the TerminalDisplay widget |
518 | 411 | // uses as foreground and background color | 411 | // uses as foreground and background color |
519 | 412 | // - Make use of KGlobalSettings::allowDefaultBackgroundImages() as | 412 | // - Make use of KGlobalSettings::allowDefaultBackgroundImages() as |
521 | 413 | // a hint to determine whether this accessible color scheme should | 413 | // a hint to determine whether this accessible color scheme should |
522 | 414 | // be used by default. | 414 | // be used by default. |
523 | 415 | // | 415 | // |
524 | 416 | // | 416 | // |
525 | @@ -443,13 +443,13 @@ | |||
526 | 443 | colorScheme.foreground( colorScheme.NeutralText ) | 443 | colorScheme.foreground( colorScheme.NeutralText ) |
527 | 444 | }; | 444 | }; |
528 | 445 | 445 | ||
530 | 446 | for ( int i = 0 ; i < TABLE_COLORS ; i++ ) | 446 | for ( int i = 0 ; i < TABLE_COLORS ; i++ ) |
531 | 447 | { | 447 | { |
532 | 448 | ColorEntry entry; | 448 | ColorEntry entry; |
533 | 449 | entry.color = colors[ i % ColorRoleCount ].color(); | 449 | entry.color = colors[ i % ColorRoleCount ].color(); |
534 | 450 | 450 | ||
537 | 451 | setColorTableEntry( i , entry ); | 451 | setColorTableEntry( i , entry ); |
538 | 452 | } | 452 | } |
539 | 453 | #endif | 453 | #endif |
540 | 454 | } | 454 | } |
541 | 455 | 455 | ||
542 | @@ -457,7 +457,7 @@ | |||
543 | 457 | _device(device) | 457 | _device(device) |
544 | 458 | { | 458 | { |
545 | 459 | } | 459 | } |
547 | 460 | ColorScheme* KDE3ColorSchemeReader::read() | 460 | ColorScheme* KDE3ColorSchemeReader::read() |
548 | 461 | { | 461 | { |
549 | 462 | Q_ASSERT( _device->openMode() == QIODevice::ReadOnly || | 462 | Q_ASSERT( _device->openMode() == QIODevice::ReadOnly || |
550 | 463 | _device->openMode() == QIODevice::ReadWrite ); | 463 | _device->openMode() == QIODevice::ReadWrite ); |
551 | @@ -488,7 +488,7 @@ | |||
552 | 488 | { | 488 | { |
553 | 489 | qDebug() << "KDE 3 color scheme contains an unsupported feature, '" << | 489 | qDebug() << "KDE 3 color scheme contains an unsupported feature, '" << |
554 | 490 | line << "'"; | 490 | line << "'"; |
556 | 491 | } | 491 | } |
557 | 492 | } | 492 | } |
558 | 493 | 493 | ||
559 | 494 | return scheme; | 494 | return scheme; |
560 | @@ -501,7 +501,7 @@ | |||
561 | 501 | return false; | 501 | return false; |
562 | 502 | if (list.first() != "color") | 502 | if (list.first() != "color") |
563 | 503 | return false; | 503 | return false; |
565 | 504 | 504 | ||
566 | 505 | int index = list[1].toInt(); | 505 | int index = list[1].toInt(); |
567 | 506 | int red = list[2].toInt(); | 506 | int red = list[2].toInt(); |
568 | 507 | int green = list[3].toInt(); | 507 | int green = list[3].toInt(); |
569 | @@ -612,7 +612,7 @@ | |||
570 | 612 | delete scheme; | 612 | delete scheme; |
571 | 613 | return false; | 613 | return false; |
572 | 614 | } | 614 | } |
574 | 615 | 615 | ||
575 | 616 | QFileInfo info(filePath); | 616 | QFileInfo info(filePath); |
576 | 617 | 617 | ||
577 | 618 | if ( !_colorSchemes.contains(info.baseName()) ) | 618 | if ( !_colorSchemes.contains(info.baseName()) ) |
578 | @@ -627,7 +627,7 @@ | |||
579 | 627 | return true; | 627 | return true; |
580 | 628 | } | 628 | } |
581 | 629 | #if 0 | 629 | #if 0 |
583 | 630 | void ColorSchemeManager::addColorScheme(ColorScheme* scheme) | 630 | void ColorSchemeManager::addColorScheme(ColorScheme* scheme) |
584 | 631 | { | 631 | { |
585 | 632 | _colorSchemes.insert(scheme->name(),scheme); | 632 | _colorSchemes.insert(scheme->name(),scheme); |
586 | 633 | 633 | ||
587 | @@ -644,17 +644,17 @@ | |||
588 | 644 | return false; | 644 | return false; |
589 | 645 | 645 | ||
590 | 646 | QFileInfo info(filePath); | 646 | QFileInfo info(filePath); |
592 | 647 | 647 | ||
593 | 648 | ColorScheme* scheme = new ColorScheme(); | 648 | ColorScheme* scheme = new ColorScheme(); |
594 | 649 | scheme->setName(info.baseName()); | 649 | scheme->setName(info.baseName()); |
595 | 650 | scheme->read(filePath); | 650 | scheme->read(filePath); |
596 | 651 | 651 | ||
598 | 652 | if (scheme->name().isEmpty()) | 652 | if (scheme->name().isEmpty()) |
599 | 653 | { | 653 | { |
600 | 654 | qDebug() << "Color scheme in" << filePath << "does not have a valid name and was not loaded."; | 654 | qDebug() << "Color scheme in" << filePath << "does not have a valid name and was not loaded."; |
601 | 655 | delete scheme; | 655 | delete scheme; |
602 | 656 | return false; | 656 | return false; |
604 | 657 | } | 657 | } |
605 | 658 | 658 | ||
606 | 659 | if ( !_colorSchemes.contains(info.baseName()) ) | 659 | if ( !_colorSchemes.contains(info.baseName()) ) |
607 | 660 | { | 660 | { |
608 | @@ -664,11 +664,11 @@ | |||
609 | 664 | { | 664 | { |
610 | 665 | qDebug() << "color scheme with name" << scheme->name() << "has already been" << | 665 | qDebug() << "color scheme with name" << scheme->name() << "has already been" << |
611 | 666 | "found, ignoring."; | 666 | "found, ignoring."; |
613 | 667 | 667 | ||
614 | 668 | delete scheme; | 668 | delete scheme; |
615 | 669 | } | 669 | } |
616 | 670 | 670 | ||
618 | 671 | return true; | 671 | return true; |
619 | 672 | } | 672 | } |
620 | 673 | QList<QString> ColorSchemeManager::listKDE3ColorSchemes() | 673 | QList<QString> ColorSchemeManager::listKDE3ColorSchemes() |
621 | 674 | { | 674 | { |
622 | @@ -677,7 +677,7 @@ | |||
623 | 677 | QStringList filters; | 677 | QStringList filters; |
624 | 678 | filters << "*.schema"; | 678 | filters << "*.schema"; |
625 | 679 | dir.setNameFilters(filters); | 679 | dir.setNameFilters(filters); |
627 | 680 | QStringList list = dir.entryList(filters); | 680 | QStringList list = dir.entryList(filters); |
628 | 681 | QStringList ret; | 681 | QStringList ret; |
629 | 682 | foreach(QString i, list) | 682 | foreach(QString i, list) |
630 | 683 | ret << dname + "/" + i; | 683 | ret << dname + "/" + i; |
631 | @@ -712,7 +712,7 @@ | |||
632 | 712 | { | 712 | { |
633 | 713 | Q_ASSERT( _colorSchemes.contains(name) ); | 713 | Q_ASSERT( _colorSchemes.contains(name) ); |
634 | 714 | 714 | ||
636 | 715 | // lookup the path and delete | 715 | // lookup the path and delete |
637 | 716 | QString path = findColorSchemePath(name); | 716 | QString path = findColorSchemePath(name); |
638 | 717 | if ( QFile::remove(path) ) | 717 | if ( QFile::remove(path) ) |
639 | 718 | { | 718 | { |
640 | @@ -730,14 +730,14 @@ | |||
641 | 730 | // QString path = KStandardDirs::locate("data","konsole/"+name+".colorscheme"); | 730 | // QString path = KStandardDirs::locate("data","konsole/"+name+".colorscheme"); |
642 | 731 | QString path(get_color_schemes_dir() + "/"+ name + ".colorscheme"); | 731 | QString path(get_color_schemes_dir() + "/"+ name + ".colorscheme"); |
643 | 732 | if ( !path.isEmpty() ) | 732 | if ( !path.isEmpty() ) |
645 | 733 | return path; | 733 | return path; |
646 | 734 | 734 | ||
647 | 735 | //path = KStandardDirs::locate("data","konsole/"+name+".schema"); | 735 | //path = KStandardDirs::locate("data","konsole/"+name+".schema"); |
648 | 736 | path = get_color_schemes_dir() + "/"+ name + ".schema"; | 736 | path = get_color_schemes_dir() + "/"+ name + ".schema"; |
649 | 737 | 737 | ||
650 | 738 | return path; | 738 | return path; |
651 | 739 | } | 739 | } |
653 | 740 | const ColorScheme* ColorSchemeManager::findColorScheme(const QString& name) | 740 | const ColorScheme* ColorSchemeManager::findColorScheme(const QString& name) |
654 | 741 | { | 741 | { |
655 | 742 | if ( name.isEmpty() ) | 742 | if ( name.isEmpty() ) |
656 | 743 | return defaultColorScheme(); | 743 | return defaultColorScheme(); |
657 | @@ -747,12 +747,12 @@ | |||
658 | 747 | else | 747 | else |
659 | 748 | { | 748 | { |
660 | 749 | // look for this color scheme | 749 | // look for this color scheme |
662 | 750 | QString path = findColorSchemePath(name); | 750 | QString path = findColorSchemePath(name); |
663 | 751 | if ( !path.isEmpty() && loadColorScheme(path) ) | 751 | if ( !path.isEmpty() && loadColorScheme(path) ) |
664 | 752 | { | 752 | { |
668 | 753 | return findColorScheme(name); | 753 | return findColorScheme(name); |
669 | 754 | } | 754 | } |
670 | 755 | else | 755 | else |
671 | 756 | { | 756 | { |
672 | 757 | if (!path.isEmpty() && loadKDE3ColorScheme(path)) | 757 | if (!path.isEmpty() && loadKDE3ColorScheme(path)) |
673 | 758 | return findColorScheme(name); | 758 | return findColorScheme(name); |
674 | @@ -760,7 +760,7 @@ | |||
675 | 760 | 760 | ||
676 | 761 | qDebug() << "Could not find color scheme - " << name; | 761 | qDebug() << "Could not find color scheme - " << name; |
677 | 762 | 762 | ||
679 | 763 | return 0; | 763 | return 0; |
680 | 764 | } | 764 | } |
681 | 765 | } | 765 | } |
682 | 766 | 766 | ||
683 | 767 | 767 | ||
684 | === modified file 'src/plugin/konsole/ColorScheme.h' | |||
685 | --- src/plugin/konsole/ColorScheme.h 2014-04-27 09:11:14 +0000 | |||
686 | +++ src/plugin/konsole/ColorScheme.h 2014-07-30 09:50:10 +0000 | |||
687 | @@ -38,16 +38,16 @@ | |||
688 | 38 | 38 | ||
689 | 39 | 39 | ||
690 | 40 | /** | 40 | /** |
692 | 41 | * Represents a color scheme for a terminal display. | 41 | * Represents a color scheme for a terminal display. |
693 | 42 | * | 42 | * |
694 | 43 | * The color scheme includes the palette of colors used to draw the text and character backgrounds | 43 | * The color scheme includes the palette of colors used to draw the text and character backgrounds |
696 | 44 | * in the display and the opacity level of the display background. | 44 | * in the display and the opacity level of the display background. |
697 | 45 | */ | 45 | */ |
698 | 46 | class ColorScheme | 46 | class ColorScheme |
699 | 47 | { | 47 | { |
700 | 48 | public: | 48 | public: |
703 | 49 | /** | 49 | /** |
704 | 50 | * Constructs a new color scheme which is initialised to the default color set | 50 | * Constructs a new color scheme which is initialised to the default color set |
705 | 51 | * for Konsole. | 51 | * for Konsole. |
706 | 52 | */ | 52 | */ |
707 | 53 | ColorScheme(); | 53 | ColorScheme(); |
708 | @@ -76,7 +76,7 @@ | |||
709 | 76 | /** Sets a single entry within the color palette. */ | 76 | /** Sets a single entry within the color palette. */ |
710 | 77 | void setColorTableEntry(int index , const ColorEntry& entry); | 77 | void setColorTableEntry(int index , const ColorEntry& entry); |
711 | 78 | 78 | ||
713 | 79 | /** | 79 | /** |
714 | 80 | * Copies the color entries which form the palette for this color scheme | 80 | * Copies the color entries which form the palette for this color scheme |
715 | 81 | * into @p table. @p table should be an array with TABLE_COLORS entries. | 81 | * into @p table. @p table should be an array with TABLE_COLORS entries. |
716 | 82 | * | 82 | * |
717 | @@ -86,7 +86,7 @@ | |||
718 | 86 | * palette to be randomized. The seed is used to pick the random color. | 86 | * palette to be randomized. The seed is used to pick the random color. |
719 | 87 | */ | 87 | */ |
720 | 88 | void getColorTable(ColorEntry* table, uint randomSeed = 0) const; | 88 | void getColorTable(ColorEntry* table, uint randomSeed = 0) const; |
722 | 89 | 89 | ||
723 | 90 | /** | 90 | /** |
724 | 91 | * Retrieves a single color entry from the table. | 91 | * Retrieves a single color entry from the table. |
725 | 92 | * | 92 | * |
726 | @@ -94,28 +94,28 @@ | |||
727 | 94 | */ | 94 | */ |
728 | 95 | ColorEntry colorEntry(int index , uint randomSeed = 0) const; | 95 | ColorEntry colorEntry(int index , uint randomSeed = 0) const; |
729 | 96 | 96 | ||
734 | 97 | /** | 97 | /** |
735 | 98 | * Convenience method. Returns the | 98 | * Convenience method. Returns the |
736 | 99 | * foreground color for this scheme, | 99 | * foreground color for this scheme, |
737 | 100 | * this is the primary color used to draw the | 100 | * this is the primary color used to draw the |
738 | 101 | * text in this scheme. | 101 | * text in this scheme. |
739 | 102 | */ | 102 | */ |
740 | 103 | QColor foregroundColor() const; | 103 | QColor foregroundColor() const; |
741 | 104 | /** | 104 | /** |
744 | 105 | * Convenience method. Returns the background color for | 105 | * Convenience method. Returns the background color for |
745 | 106 | * this scheme, this is the primary color used to | 106 | * this scheme, this is the primary color used to |
746 | 107 | * draw the terminal background in this scheme. | 107 | * draw the terminal background in this scheme. |
747 | 108 | */ | 108 | */ |
748 | 109 | QColor backgroundColor() const; | 109 | QColor backgroundColor() const; |
749 | 110 | 110 | ||
751 | 111 | /** | 111 | /** |
752 | 112 | * Returns true if this color scheme has a dark background. | 112 | * Returns true if this color scheme has a dark background. |
753 | 113 | * The background color is said to be dark if it has a value of less than 127 | 113 | * The background color is said to be dark if it has a value of less than 127 |
754 | 114 | * in the HSV color space. | 114 | * in the HSV color space. |
755 | 115 | */ | 115 | */ |
756 | 116 | bool hasDarkBackground() const; | 116 | bool hasDarkBackground() const; |
757 | 117 | 117 | ||
759 | 118 | /** | 118 | /** |
760 | 119 | * Sets the opacity level of the display background. @p opacity ranges | 119 | * Sets the opacity level of the display background. @p opacity ranges |
761 | 120 | * between 0 (completely transparent background) and 1 (completely | 120 | * between 0 (completely transparent background) and 1 (completely |
762 | 121 | * opaque background). | 121 | * opaque background). |
763 | @@ -125,18 +125,18 @@ | |||
764 | 125 | * TODO: More documentation | 125 | * TODO: More documentation |
765 | 126 | */ | 126 | */ |
766 | 127 | void setOpacity(qreal opacity); | 127 | void setOpacity(qreal opacity); |
768 | 128 | /** | 128 | /** |
769 | 129 | * Returns the opacity level for this color scheme, see setOpacity() | 129 | * Returns the opacity level for this color scheme, see setOpacity() |
770 | 130 | * TODO: More documentation | 130 | * TODO: More documentation |
771 | 131 | */ | 131 | */ |
772 | 132 | qreal opacity() const; | 132 | qreal opacity() const; |
773 | 133 | 133 | ||
775 | 134 | /** | 134 | /** |
776 | 135 | * Enables randomization of the background color. This will cause | 135 | * Enables randomization of the background color. This will cause |
777 | 136 | * the palette returned by getColorTable() and colorEntry() to | 136 | * the palette returned by getColorTable() and colorEntry() to |
778 | 137 | * be adjusted depending on the value of the random seed argument | 137 | * be adjusted depending on the value of the random seed argument |
779 | 138 | * to them. | 138 | * to them. |
781 | 139 | */ | 139 | */ |
782 | 140 | void setRandomizedBackgroundColor(bool randomize); | 140 | void setRandomizedBackgroundColor(bool randomize); |
783 | 141 | 141 | ||
784 | 142 | /** Returns true if the background color is randomized. */ | 142 | /** Returns true if the background color is randomized. */ |
785 | @@ -152,7 +152,7 @@ | |||
786 | 152 | public: | 152 | public: |
787 | 153 | RandomizationRange() : hue(0) , saturation(0) , value(0) {} | 153 | RandomizationRange() : hue(0) , saturation(0) , value(0) {} |
788 | 154 | 154 | ||
790 | 155 | bool isNull() const | 155 | bool isNull() const |
791 | 156 | { | 156 | { |
792 | 157 | return ( hue == 0 && saturation == 0 && value == 0 ); | 157 | return ( hue == 0 && saturation == 0 && value == 0 ); |
793 | 158 | } | 158 | } |
794 | @@ -170,14 +170,14 @@ | |||
795 | 170 | // implemented upstream - user apps | 170 | // implemented upstream - user apps |
796 | 171 | // reads a single colour entry from a KConfig source | 171 | // reads a single colour entry from a KConfig source |
797 | 172 | // and sets the palette entry at 'index' to the entry read. | 172 | // and sets the palette entry at 'index' to the entry read. |
799 | 173 | void readColorEntry(KConfig& config , int index); | 173 | void readColorEntry(KConfig& config , int index); |
800 | 174 | // writes a single colour entry to a KConfig source | 174 | // writes a single colour entry to a KConfig source |
801 | 175 | void writeColorEntry(KConfig& config , const QString& colorName, const ColorEntry& entry,const RandomizationRange& range) const; | 175 | void writeColorEntry(KConfig& config , const QString& colorName, const ColorEntry& entry,const RandomizationRange& range) const; |
802 | 176 | #endif | 176 | #endif |
803 | 177 | void readColorEntry(QSettings *s, int index); | 177 | void readColorEntry(QSettings *s, int index); |
804 | 178 | 178 | ||
807 | 179 | // sets the amount of randomization allowed for a particular color | 179 | // sets the amount of randomization allowed for a particular color |
808 | 180 | // in the palette. creates the randomization table if | 180 | // in the palette. creates the randomization table if |
809 | 181 | // it does not already exist | 181 | // it does not already exist |
810 | 182 | void setRandomizationRange( int index , quint16 hue , quint8 saturation , quint8 value ); | 182 | void setRandomizationRange( int index , quint16 hue , quint8 saturation , quint8 value ); |
811 | 183 | 183 | ||
812 | @@ -200,7 +200,7 @@ | |||
813 | 200 | static const ColorEntry defaultTable[]; // table of default color entries | 200 | static const ColorEntry defaultTable[]; // table of default color entries |
814 | 201 | }; | 201 | }; |
815 | 202 | 202 | ||
817 | 203 | /** | 203 | /** |
818 | 204 | * A color scheme which uses colors from the standard KDE color palette. | 204 | * A color scheme which uses colors from the standard KDE color palette. |
819 | 205 | * | 205 | * |
820 | 206 | * This is designed primarily for the benefit of users who are using specially | 206 | * This is designed primarily for the benefit of users who are using specially |
821 | @@ -226,13 +226,13 @@ | |||
822 | 226 | class KDE3ColorSchemeReader | 226 | class KDE3ColorSchemeReader |
823 | 227 | { | 227 | { |
824 | 228 | public: | 228 | public: |
828 | 229 | /** | 229 | /** |
829 | 230 | * Constructs a new reader which reads from the specified device. | 230 | * Constructs a new reader which reads from the specified device. |
830 | 231 | * The device should be open in read-only mode. | 231 | * The device should be open in read-only mode. |
831 | 232 | */ | 232 | */ |
832 | 233 | KDE3ColorSchemeReader( QIODevice* device ); | 233 | KDE3ColorSchemeReader( QIODevice* device ); |
833 | 234 | 234 | ||
835 | 235 | /** | 235 | /** |
836 | 236 | * Reads and parses the contents of the .schema file from the input | 236 | * Reads and parses the contents of the .schema file from the input |
837 | 237 | * device and returns the ColorScheme defined within it. | 237 | * device and returns the ColorScheme defined within it. |
838 | 238 | * | 238 | * |
839 | @@ -275,7 +275,7 @@ | |||
840 | 275 | * Returns the default color scheme for Konsole | 275 | * Returns the default color scheme for Konsole |
841 | 276 | */ | 276 | */ |
842 | 277 | const ColorScheme* defaultColorScheme() const; | 277 | const ColorScheme* defaultColorScheme() const; |
844 | 278 | 278 | ||
845 | 279 | /** | 279 | /** |
846 | 280 | * Returns the color scheme with the given name or 0 if no | 280 | * Returns the color scheme with the given name or 0 if no |
847 | 281 | * scheme with that name exists. If @p name is empty, the | 281 | * scheme with that name exists. If @p name is empty, the |
848 | @@ -296,18 +296,18 @@ | |||
849 | 296 | void addColorScheme(ColorScheme* scheme); | 296 | void addColorScheme(ColorScheme* scheme); |
850 | 297 | #endif | 297 | #endif |
851 | 298 | /** | 298 | /** |
853 | 299 | * Deletes a color scheme. Returns true on successful deletion or false otherwise. | 299 | * Deletes a color scheme. Returns true on successful deletion or false otherwise. |
854 | 300 | */ | 300 | */ |
855 | 301 | bool deleteColorScheme(const QString& name); | 301 | bool deleteColorScheme(const QString& name); |
856 | 302 | 302 | ||
859 | 303 | /** | 303 | /** |
860 | 304 | * Returns a list of the all the available color schemes. | 304 | * Returns a list of the all the available color schemes. |
861 | 305 | * This may be slow when first called because all of the color | 305 | * This may be slow when first called because all of the color |
862 | 306 | * scheme resources on disk must be located, read and parsed. | 306 | * scheme resources on disk must be located, read and parsed. |
863 | 307 | * | 307 | * |
865 | 308 | * Subsequent calls will be inexpensive. | 308 | * Subsequent calls will be inexpensive. |
866 | 309 | */ | 309 | */ |
868 | 310 | QList<const ColorScheme*> allColorSchemes(); | 310 | QList<const ColorScheme*> allColorSchemes(); |
869 | 311 | 311 | ||
870 | 312 | /** Returns the global color scheme manager instance. */ | 312 | /** Returns the global color scheme manager instance. */ |
871 | 313 | static ColorSchemeManager* instance(); | 313 | static ColorSchemeManager* instance(); |
872 | 314 | 314 | ||
873 | === modified file 'src/plugin/konsole/Emulation.cpp' | |||
874 | --- src/plugin/konsole/Emulation.cpp 2014-04-27 09:11:14 +0000 | |||
875 | +++ src/plugin/konsole/Emulation.cpp 2014-07-30 09:50:10 +0000 | |||
876 | @@ -1,5 +1,5 @@ | |||
877 | 1 | /* | 1 | /* |
879 | 2 | Copyright 2007-2008 Robert Knight <robertknight@gmail.com> | 2 | Copyright 2007-2008 Robert Knight <robertknight@gmail.com> |
880 | 3 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> | 3 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> |
881 | 4 | Copyright 1996 by Matthias Ettrich <ettrich@kde.org> | 4 | Copyright 1996 by Matthias Ettrich <ettrich@kde.org> |
882 | 5 | 5 | ||
883 | @@ -62,9 +62,9 @@ | |||
884 | 62 | 62 | ||
885 | 63 | QObject::connect(&_bulkTimer1, SIGNAL(timeout()), this, SLOT(showBulk()) ); | 63 | QObject::connect(&_bulkTimer1, SIGNAL(timeout()), this, SLOT(showBulk()) ); |
886 | 64 | QObject::connect(&_bulkTimer2, SIGNAL(timeout()), this, SLOT(showBulk()) ); | 64 | QObject::connect(&_bulkTimer2, SIGNAL(timeout()), this, SLOT(showBulk()) ); |
888 | 65 | 65 | ||
889 | 66 | // listen for mouse status changes | 66 | // listen for mouse status changes |
891 | 67 | connect( this , SIGNAL(programUsesMouseChanged(bool)) , | 67 | connect( this , SIGNAL(programUsesMouseChanged(bool)) , |
892 | 68 | SLOT(usesMouseChanged(bool)) ); | 68 | SLOT(usesMouseChanged(bool)) ); |
893 | 69 | } | 69 | } |
894 | 70 | 70 | ||
895 | @@ -110,7 +110,7 @@ | |||
896 | 110 | { | 110 | { |
897 | 111 | Screen *old = _currentScreen; | 111 | Screen *old = _currentScreen; |
898 | 112 | _currentScreen = _screen[n & 1]; | 112 | _currentScreen = _screen[n & 1]; |
900 | 113 | if (_currentScreen != old) | 113 | if (_currentScreen != old) |
901 | 114 | { | 114 | { |
902 | 115 | // tell all windows onto this emulation to switch to the newly active screen | 115 | // tell all windows onto this emulation to switch to the newly active screen |
903 | 116 | foreach(ScreenWindow* window,_windows) | 116 | foreach(ScreenWindow* window,_windows) |
904 | @@ -189,7 +189,7 @@ | |||
905 | 189 | void Emulation::sendKeyEvent( QKeyEvent* ev ) | 189 | void Emulation::sendKeyEvent( QKeyEvent* ev ) |
906 | 190 | { | 190 | { |
907 | 191 | emit stateSet(NOTIFYNORMAL); | 191 | emit stateSet(NOTIFYNORMAL); |
909 | 192 | 192 | ||
910 | 193 | if (!ev->text().isEmpty()) | 193 | if (!ev->text().isEmpty()) |
911 | 194 | { // A block of text | 194 | { // A block of text |
912 | 195 | // Note that the text is proper unicode. | 195 | // Note that the text is proper unicode. |
913 | @@ -218,7 +218,7 @@ | |||
914 | 218 | emit stateSet(NOTIFYACTIVITY); | 218 | emit stateSet(NOTIFYACTIVITY); |
915 | 219 | 219 | ||
916 | 220 | bufferedUpdate(); | 220 | bufferedUpdate(); |
918 | 221 | 221 | ||
919 | 222 | QString unicodeText = _decoder->toUnicode(text,length); | 222 | QString unicodeText = _decoder->toUnicode(text,length); |
920 | 223 | 223 | ||
921 | 224 | //send characters to terminal emulator | 224 | //send characters to terminal emulator |
922 | @@ -246,13 +246,13 @@ | |||
923 | 246 | // | 246 | // |
924 | 247 | //There is something about stopping the _decoder if "we get a control code halfway a multi-byte sequence" (see below) | 247 | //There is something about stopping the _decoder if "we get a control code halfway a multi-byte sequence" (see below) |
925 | 248 | //which hasn't been ported into the newer function (above). Hopefully someone who understands this better | 248 | //which hasn't been ported into the newer function (above). Hopefully someone who understands this better |
927 | 249 | //can find an alternative way of handling the check. | 249 | //can find an alternative way of handling the check. |
928 | 250 | 250 | ||
929 | 251 | 251 | ||
930 | 252 | /*void Emulation::onRcvBlock(const char *s, int len) | 252 | /*void Emulation::onRcvBlock(const char *s, int len) |
931 | 253 | { | 253 | { |
932 | 254 | emit notifySessionState(NOTIFYACTIVITY); | 254 | emit notifySessionState(NOTIFYACTIVITY); |
934 | 255 | 255 | ||
935 | 256 | bufferedUpdate(); | 256 | bufferedUpdate(); |
936 | 257 | for (int i = 0; i < len; i++) | 257 | for (int i = 0; i < len; i++) |
937 | 258 | { | 258 | { |
938 | @@ -287,9 +287,9 @@ | |||
939 | 287 | } | 287 | } |
940 | 288 | }*/ | 288 | }*/ |
941 | 289 | 289 | ||
943 | 290 | void Emulation::writeToStream( TerminalCharacterDecoder* _decoder , | 290 | void Emulation::writeToStream( TerminalCharacterDecoder* _decoder , |
944 | 291 | int startLine , | 291 | int startLine , |
946 | 292 | int endLine) | 292 | int endLine) |
947 | 293 | { | 293 | { |
948 | 294 | _currentScreen->writeLinesToStream(_decoder,startLine,endLine); | 294 | _currentScreen->writeLinesToStream(_decoder,startLine,endLine); |
949 | 295 | } | 295 | } |
950 | @@ -332,7 +332,7 @@ | |||
951 | 332 | 332 | ||
952 | 333 | void Emulation::setImageSize(int lines, int columns) | 333 | void Emulation::setImageSize(int lines, int columns) |
953 | 334 | { | 334 | { |
955 | 335 | if ((lines < 1) || (columns < 1)) | 335 | if ((lines < 1) || (columns < 1)) |
956 | 336 | return; | 336 | return; |
957 | 337 | 337 | ||
958 | 338 | QSize screenSize[2] = { QSize(_screen[0]->getColumns(), | 338 | QSize screenSize[2] = { QSize(_screen[0]->getColumns(), |
959 | @@ -342,7 +342,7 @@ | |||
960 | 342 | QSize newSize(columns,lines); | 342 | QSize newSize(columns,lines); |
961 | 343 | 343 | ||
962 | 344 | if (newSize == screenSize[0] && newSize == screenSize[1]) | 344 | if (newSize == screenSize[0] && newSize == screenSize[1]) |
964 | 345 | return; | 345 | return; |
965 | 346 | 346 | ||
966 | 347 | _screen[0]->resizeImage(lines,columns); | 347 | _screen[0]->resizeImage(lines,columns); |
967 | 348 | _screen[1]->resizeImage(lines,columns); | 348 | _screen[1]->resizeImage(lines,columns); |
968 | @@ -370,17 +370,17 @@ | |||
969 | 370 | { | 370 | { |
970 | 371 | ushort* entry = extendedCharTable[hash]; | 371 | ushort* entry = extendedCharTable[hash]; |
971 | 372 | 372 | ||
975 | 373 | // compare given length with stored sequence length ( given as the first ushort in the | 373 | // compare given length with stored sequence length ( given as the first ushort in the |
976 | 374 | // stored buffer ) | 374 | // stored buffer ) |
977 | 375 | if ( entry == 0 || entry[0] != length ) | 375 | if ( entry == 0 || entry[0] != length ) |
978 | 376 | return false; | 376 | return false; |
979 | 377 | // if the lengths match, each character must be checked. the stored buffer starts at | 377 | // if the lengths match, each character must be checked. the stored buffer starts at |
980 | 378 | // entry[1] | 378 | // entry[1] |
981 | 379 | for ( int i = 0 ; i < length ; i++ ) | 379 | for ( int i = 0 ; i < length ; i++ ) |
982 | 380 | { | 380 | { |
983 | 381 | if ( entry[i+1] != unicodePoints[i] ) | 381 | if ( entry[i+1] != unicodePoints[i] ) |
986 | 382 | return false; | 382 | return false; |
987 | 383 | } | 383 | } |
988 | 384 | return true; | 384 | return true; |
989 | 385 | } | 385 | } |
990 | 386 | ushort ExtendedCharTable::createExtendedChar(ushort* unicodePoints , ushort length) | 386 | ushort ExtendedCharTable::createExtendedChar(ushort* unicodePoints , ushort length) |
991 | @@ -393,7 +393,7 @@ | |||
992 | 393 | { | 393 | { |
993 | 394 | if ( extendedCharMatch(hash,unicodePoints,length) ) | 394 | if ( extendedCharMatch(hash,unicodePoints,length) ) |
994 | 395 | { | 395 | { |
996 | 396 | // this sequence already has an entry in the table, | 396 | // this sequence already has an entry in the table, |
997 | 397 | // return its hash | 397 | // return its hash |
998 | 398 | return hash; | 398 | return hash; |
999 | 399 | } | 399 | } |
1000 | @@ -403,16 +403,16 @@ | |||
1001 | 403 | // points then try next hash | 403 | // points then try next hash |
1002 | 404 | hash++; | 404 | hash++; |
1003 | 405 | } | 405 | } |
1007 | 406 | } | 406 | } |
1008 | 407 | 407 | ||
1009 | 408 | 408 | ||
1010 | 409 | // add the new sequence to the table and | 409 | // add the new sequence to the table and |
1011 | 410 | // return that index | 410 | // return that index |
1012 | 411 | ushort* buffer = new ushort[length+1]; | 411 | ushort* buffer = new ushort[length+1]; |
1013 | 412 | buffer[0] = length; | 412 | buffer[0] = length; |
1014 | 413 | for ( int i = 0 ; i < length ; i++ ) | 413 | for ( int i = 0 ; i < length ; i++ ) |
1017 | 414 | buffer[i+1] = unicodePoints[i]; | 414 | buffer[i+1] = unicodePoints[i]; |
1018 | 415 | 415 | ||
1019 | 416 | extendedCharTable.insert(hash,buffer); | 416 | extendedCharTable.insert(hash,buffer); |
1020 | 417 | 417 | ||
1021 | 418 | return hash; | 418 | return hash; |
1022 | 419 | 419 | ||
1023 | === modified file 'src/plugin/konsole/Emulation.h' | |||
1024 | --- src/plugin/konsole/Emulation.h 2014-04-27 09:11:14 +0000 | |||
1025 | +++ src/plugin/konsole/Emulation.h 2014-07-30 09:50:10 +0000 | |||
1026 | @@ -1,6 +1,6 @@ | |||
1027 | 1 | /* | 1 | /* |
1028 | 2 | This file is part of Konsole, an X terminal. | 2 | This file is part of Konsole, an X terminal. |
1030 | 3 | 3 | ||
1031 | 4 | Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> | 4 | Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> |
1032 | 5 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> | 5 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> |
1033 | 6 | 6 | ||
1034 | @@ -26,7 +26,7 @@ | |||
1035 | 26 | // System | 26 | // System |
1036 | 27 | #include <stdio.h> | 27 | #include <stdio.h> |
1037 | 28 | 28 | ||
1039 | 29 | // Qt | 29 | // Qt |
1040 | 30 | #include <QtGui/QKeyEvent> | 30 | #include <QtGui/QKeyEvent> |
1041 | 31 | //#include <QPointer> | 31 | //#include <QPointer> |
1042 | 32 | #include <QtCore/QTextCodec> | 32 | #include <QtCore/QTextCodec> |
1043 | @@ -43,56 +43,56 @@ | |||
1044 | 43 | class ScreenWindow; | 43 | class ScreenWindow; |
1045 | 44 | class TerminalCharacterDecoder; | 44 | class TerminalCharacterDecoder; |
1046 | 45 | 45 | ||
1049 | 46 | /** | 46 | /** |
1050 | 47 | * This enum describes the available states which | 47 | * This enum describes the available states which |
1051 | 48 | * the terminal emulation may be set to. | 48 | * the terminal emulation may be set to. |
1052 | 49 | * | 49 | * |
1054 | 50 | * These are the values used by Emulation::stateChanged() | 50 | * These are the values used by Emulation::stateChanged() |
1055 | 51 | */ | 51 | */ |
1058 | 52 | enum | 52 | enum |
1059 | 53 | { | 53 | { |
1060 | 54 | /** The emulation is currently receiving user input. */ | 54 | /** The emulation is currently receiving user input. */ |
1063 | 55 | NOTIFYNORMAL=0, | 55 | NOTIFYNORMAL=0, |
1064 | 56 | /** | 56 | /** |
1065 | 57 | * The terminal program has triggered a bell event | 57 | * The terminal program has triggered a bell event |
1066 | 58 | * to get the user's attention. | 58 | * to get the user's attention. |
1067 | 59 | */ | 59 | */ |
1071 | 60 | NOTIFYBELL=1, | 60 | NOTIFYBELL=1, |
1072 | 61 | /** | 61 | /** |
1073 | 62 | * The emulation is currently receiving data from its | 62 | * The emulation is currently receiving data from its |
1074 | 63 | * terminal input. | 63 | * terminal input. |
1075 | 64 | */ | 64 | */ |
1076 | 65 | NOTIFYACTIVITY=2, | 65 | NOTIFYACTIVITY=2, |
1077 | 66 | 66 | ||
1080 | 67 | // unused here? | 67 | // unused here? |
1081 | 68 | NOTIFYSILENCE=3 | 68 | NOTIFYSILENCE=3 |
1082 | 69 | }; | 69 | }; |
1083 | 70 | 70 | ||
1084 | 71 | /** | 71 | /** |
1085 | 72 | * Base class for terminal emulation back-ends. | 72 | * Base class for terminal emulation back-ends. |
1086 | 73 | * | 73 | * |
1088 | 74 | * The back-end is responsible for decoding an incoming character stream and | 74 | * The back-end is responsible for decoding an incoming character stream and |
1089 | 75 | * producing an output image of characters. | 75 | * producing an output image of characters. |
1090 | 76 | * | 76 | * |
1091 | 77 | * When input from the terminal is received, the receiveData() slot should be called with | 77 | * When input from the terminal is received, the receiveData() slot should be called with |
1093 | 78 | * the data which has arrived. The emulation will process the data and update the | 78 | * the data which has arrived. The emulation will process the data and update the |
1094 | 79 | * screen image accordingly. The codec used to decode the incoming character stream | 79 | * screen image accordingly. The codec used to decode the incoming character stream |
1096 | 80 | * into the unicode characters used internally can be specified using setCodec() | 80 | * into the unicode characters used internally can be specified using setCodec() |
1097 | 81 | * | 81 | * |
1099 | 82 | * The size of the screen image can be specified by calling setImageSize() with the | 82 | * The size of the screen image can be specified by calling setImageSize() with the |
1100 | 83 | * desired number of lines and columns. When new lines are added, old content | 83 | * desired number of lines and columns. When new lines are added, old content |
1102 | 84 | * is moved into a history store, which can be set by calling setHistory(). | 84 | * is moved into a history store, which can be set by calling setHistory(). |
1103 | 85 | * | 85 | * |
1107 | 86 | * The screen image can be accessed by creating a ScreenWindow onto this emulation | 86 | * The screen image can be accessed by creating a ScreenWindow onto this emulation |
1108 | 87 | * by calling createWindow(). Screen windows provide access to a section of the | 87 | * by calling createWindow(). Screen windows provide access to a section of the |
1109 | 88 | * output. Each screen window covers the same number of lines and columns as the | 88 | * output. Each screen window covers the same number of lines and columns as the |
1110 | 89 | * image size returned by imageSize(). The screen window can be moved up and down | 89 | * image size returned by imageSize(). The screen window can be moved up and down |
1112 | 90 | * and provides transparent access to both the current on-screen image and the | 90 | * and provides transparent access to both the current on-screen image and the |
1113 | 91 | * previous output. The screen windows emit an outputChanged signal | 91 | * previous output. The screen windows emit an outputChanged signal |
1114 | 92 | * when the section of the image they are looking at changes. | 92 | * when the section of the image they are looking at changes. |
1115 | 93 | * Graphical views can then render the contents of a screen window, listening for notifications | 93 | * Graphical views can then render the contents of a screen window, listening for notifications |
1118 | 94 | * of output changes from the screen window which they are associated with and updating | 94 | * of output changes from the screen window which they are associated with and updating |
1119 | 95 | * accordingly. | 95 | * accordingly. |
1120 | 96 | * | 96 | * |
1121 | 97 | * The emulation also is also responsible for converting input from the connected views such | 97 | * The emulation also is also responsible for converting input from the connected views such |
1122 | 98 | * as keypresses and mouse activity into a character string which can be sent | 98 | * as keypresses and mouse activity into a character string which can be sent |
1123 | @@ -105,9 +105,9 @@ | |||
1124 | 105 | * character sequences. The name of the key bindings set used can be specified using | 105 | * character sequences. The name of the key bindings set used can be specified using |
1125 | 106 | * setKeyBindings() | 106 | * setKeyBindings() |
1126 | 107 | * | 107 | * |
1130 | 108 | * The emulation maintains certain state information which changes depending on the | 108 | * The emulation maintains certain state information which changes depending on the |
1131 | 109 | * input received. The emulation can be reset back to its starting state by calling | 109 | * input received. The emulation can be reset back to its starting state by calling |
1132 | 110 | * reset(). | 110 | * reset(). |
1133 | 111 | * | 111 | * |
1134 | 112 | * The emulation also maintains an activity state, which specifies whether | 112 | * The emulation also maintains an activity state, which specifies whether |
1135 | 113 | * terminal is currently active ( when data is received ), normal | 113 | * terminal is currently active ( when data is received ), normal |
1136 | @@ -118,12 +118,12 @@ | |||
1137 | 118 | * a 'bell' event in different ways. | 118 | * a 'bell' event in different ways. |
1138 | 119 | */ | 119 | */ |
1139 | 120 | class KONSOLEPRIVATE_EXPORT Emulation : public QObject | 120 | class KONSOLEPRIVATE_EXPORT Emulation : public QObject |
1141 | 121 | { | 121 | { |
1142 | 122 | Q_OBJECT | 122 | Q_OBJECT |
1143 | 123 | 123 | ||
1144 | 124 | public: | 124 | public: |
1147 | 125 | 125 | ||
1148 | 126 | /** Constructs a new terminal emulation */ | 126 | /** Constructs a new terminal emulation */ |
1149 | 127 | Emulation(); | 127 | Emulation(); |
1150 | 128 | ~Emulation(); | 128 | ~Emulation(); |
1151 | 129 | 129 | ||
1152 | @@ -139,15 +139,15 @@ | |||
1153 | 139 | 139 | ||
1154 | 140 | /** | 140 | /** |
1155 | 141 | * Returns the total number of lines, including those stored in the history. | 141 | * Returns the total number of lines, including those stored in the history. |
1157 | 142 | */ | 142 | */ |
1158 | 143 | int lineCount() const; | 143 | int lineCount() const; |
1159 | 144 | 144 | ||
1161 | 145 | /** | 145 | /** |
1162 | 146 | * Sets the history store used by this emulation. When new lines | 146 | * Sets the history store used by this emulation. When new lines |
1163 | 147 | * are added to the output, older lines at the top of the screen are transferred to a history | 147 | * are added to the output, older lines at the top of the screen are transferred to a history |
1165 | 148 | * store. | 148 | * store. |
1166 | 149 | * | 149 | * |
1168 | 150 | * The number of lines which are kept and the storage location depend on the | 150 | * The number of lines which are kept and the storage location depend on the |
1169 | 151 | * type of store. | 151 | * type of store. |
1170 | 152 | */ | 152 | */ |
1171 | 153 | void setHistory(const HistoryType&); | 153 | void setHistory(const HistoryType&); |
1172 | @@ -156,49 +156,49 @@ | |||
1173 | 156 | /** Clears the history scroll. */ | 156 | /** Clears the history scroll. */ |
1174 | 157 | void clearHistory(); | 157 | void clearHistory(); |
1175 | 158 | 158 | ||
1178 | 159 | /** | 159 | /** |
1179 | 160 | * Copies the output history from @p startLine to @p endLine | 160 | * Copies the output history from @p startLine to @p endLine |
1180 | 161 | * into @p stream, using @p decoder to convert the terminal | 161 | * into @p stream, using @p decoder to convert the terminal |
1182 | 162 | * characters into text. | 162 | * characters into text. |
1183 | 163 | * | 163 | * |
1185 | 164 | * @param decoder A decoder which converts lines of terminal characters with | 164 | * @param decoder A decoder which converts lines of terminal characters with |
1186 | 165 | * appearance attributes into output text. PlainTextDecoder is the most commonly | 165 | * appearance attributes into output text. PlainTextDecoder is the most commonly |
1187 | 166 | * used decoder. | 166 | * used decoder. |
1188 | 167 | * @param startLine Index of first line to copy | 167 | * @param startLine Index of first line to copy |
1189 | 168 | * @param endLine Index of last line to copy | 168 | * @param endLine Index of last line to copy |
1190 | 169 | */ | 169 | */ |
1191 | 170 | virtual void writeToStream(TerminalCharacterDecoder* decoder,int startLine,int endLine); | 170 | virtual void writeToStream(TerminalCharacterDecoder* decoder,int startLine,int endLine); |
1193 | 171 | 171 | ||
1194 | 172 | /** Returns the codec used to decode incoming characters. See setCodec() */ | 172 | /** Returns the codec used to decode incoming characters. See setCodec() */ |
1195 | 173 | const QTextCodec* codec() const { return _codec; } | 173 | const QTextCodec* codec() const { return _codec; } |
1196 | 174 | /** Sets the codec used to decode incoming characters. */ | 174 | /** Sets the codec used to decode incoming characters. */ |
1197 | 175 | void setCodec(const QTextCodec*); | 175 | void setCodec(const QTextCodec*); |
1198 | 176 | 176 | ||
1201 | 177 | /** | 177 | /** |
1202 | 178 | * Convenience method. | 178 | * Convenience method. |
1203 | 179 | * Returns true if the current codec used to decode incoming | 179 | * Returns true if the current codec used to decode incoming |
1204 | 180 | * characters is UTF-8 | 180 | * characters is UTF-8 |
1205 | 181 | */ | 181 | */ |
1206 | 182 | bool utf8() const | 182 | bool utf8() const |
1207 | 183 | { Q_ASSERT(_codec); return _codec->mibEnum() == 106; } | 183 | { Q_ASSERT(_codec); return _codec->mibEnum() == 106; } |
1209 | 184 | 184 | ||
1210 | 185 | 185 | ||
1211 | 186 | /** TODO Document me */ | 186 | /** TODO Document me */ |
1212 | 187 | virtual char eraseChar() const; | 187 | virtual char eraseChar() const; |
1213 | 188 | 188 | ||
1215 | 189 | /** | 189 | /** |
1216 | 190 | * Sets the key bindings used to key events | 190 | * Sets the key bindings used to key events |
1217 | 191 | * ( received through sendKeyEvent() ) into character | 191 | * ( received through sendKeyEvent() ) into character |
1218 | 192 | * streams to send to the terminal. | 192 | * streams to send to the terminal. |
1219 | 193 | */ | 193 | */ |
1220 | 194 | void setKeyBindings(const QString& name); | 194 | void setKeyBindings(const QString& name); |
1222 | 195 | /** | 195 | /** |
1223 | 196 | * Returns the name of the emulation's current key bindings. | 196 | * Returns the name of the emulation's current key bindings. |
1224 | 197 | * See setKeyBindings() | 197 | * See setKeyBindings() |
1225 | 198 | */ | 198 | */ |
1226 | 199 | QString keyBindings() const; | 199 | QString keyBindings() const; |
1227 | 200 | 200 | ||
1229 | 201 | /** | 201 | /** |
1230 | 202 | * Copies the current image into the history and clears the screen. | 202 | * Copies the current image into the history and clears the screen. |
1231 | 203 | */ | 203 | */ |
1232 | 204 | virtual void clearEntireScreen() =0; | 204 | virtual void clearEntireScreen() =0; |
1233 | @@ -206,7 +206,7 @@ | |||
1234 | 206 | /** Resets the state of the terminal. */ | 206 | /** Resets the state of the terminal. */ |
1235 | 207 | virtual void reset() =0; | 207 | virtual void reset() =0; |
1236 | 208 | 208 | ||
1238 | 209 | /** | 209 | /** |
1239 | 210 | * Returns true if the active terminal program wants | 210 | * Returns true if the active terminal program wants |
1240 | 211 | * mouse input events. | 211 | * mouse input events. |
1241 | 212 | * | 212 | * |
1242 | @@ -215,42 +215,42 @@ | |||
1243 | 215 | */ | 215 | */ |
1244 | 216 | bool programUsesMouse() const; | 216 | bool programUsesMouse() const; |
1245 | 217 | 217 | ||
1247 | 218 | public slots: | 218 | public slots: |
1248 | 219 | 219 | ||
1249 | 220 | /** Change the size of the emulation's image */ | 220 | /** Change the size of the emulation's image */ |
1250 | 221 | virtual void setImageSize(int lines, int columns); | 221 | virtual void setImageSize(int lines, int columns); |
1253 | 222 | 222 | ||
1254 | 223 | /** | 223 | /** |
1255 | 224 | * Interprets a sequence of characters and sends the result to the terminal. | 224 | * Interprets a sequence of characters and sends the result to the terminal. |
1256 | 225 | * This is equivalent to calling sendKeyEvent() for each character in @p text in succession. | 225 | * This is equivalent to calling sendKeyEvent() for each character in @p text in succession. |
1257 | 226 | */ | 226 | */ |
1258 | 227 | virtual void sendText(const QString& text) = 0; | 227 | virtual void sendText(const QString& text) = 0; |
1259 | 228 | 228 | ||
1261 | 229 | /** | 229 | /** |
1262 | 230 | * Interprets a key press event and emits the sendData() signal with | 230 | * Interprets a key press event and emits the sendData() signal with |
1264 | 231 | * the resulting character stream. | 231 | * the resulting character stream. |
1265 | 232 | */ | 232 | */ |
1266 | 233 | virtual void sendKeyEvent(QKeyEvent*); | 233 | virtual void sendKeyEvent(QKeyEvent*); |
1269 | 234 | 234 | ||
1270 | 235 | /** | 235 | /** |
1271 | 236 | * Converts information about a mouse event into an xterm-compatible escape | 236 | * Converts information about a mouse event into an xterm-compatible escape |
1272 | 237 | * sequence and emits the character sequence via sendData() | 237 | * sequence and emits the character sequence via sendData() |
1273 | 238 | */ | 238 | */ |
1274 | 239 | virtual void sendMouseEvent(int buttons, int column, int line, int eventType); | 239 | virtual void sendMouseEvent(int buttons, int column, int line, int eventType); |
1276 | 240 | 240 | ||
1277 | 241 | /** | 241 | /** |
1279 | 242 | * Sends a string of characters to the foreground terminal process. | 242 | * Sends a string of characters to the foreground terminal process. |
1280 | 243 | * | 243 | * |
1282 | 244 | * @param string The characters to send. | 244 | * @param string The characters to send. |
1283 | 245 | * @param length Length of @p string or if set to a negative value, @p string will | 245 | * @param length Length of @p string or if set to a negative value, @p string will |
1284 | 246 | * be treated as a null-terminated string and its length will be determined automatically. | 246 | * be treated as a null-terminated string and its length will be determined automatically. |
1285 | 247 | */ | 247 | */ |
1286 | 248 | virtual void sendString(const char* string, int length = -1) = 0; | 248 | virtual void sendString(const char* string, int length = -1) = 0; |
1287 | 249 | 249 | ||
1289 | 250 | /** | 250 | /** |
1290 | 251 | * Processes an incoming stream of characters. receiveData() decodes the incoming | 251 | * Processes an incoming stream of characters. receiveData() decodes the incoming |
1291 | 252 | * character buffer using the current codec(), and then calls receiveChar() for | 252 | * character buffer using the current codec(), and then calls receiveChar() for |
1293 | 253 | * each unicode character in the resulting buffer. | 253 | * each unicode character in the resulting buffer. |
1294 | 254 | * | 254 | * |
1295 | 255 | * receiveData() also starts a timer which causes the outputChanged() signal | 255 | * receiveData() also starts a timer which causes the outputChanged() signal |
1296 | 256 | * to be emitted when it expires. The timer allows multiple updates in quick | 256 | * to be emitted when it expires. The timer allows multiple updates in quick |
1297 | @@ -263,8 +263,8 @@ | |||
1298 | 263 | 263 | ||
1299 | 264 | signals: | 264 | signals: |
1300 | 265 | 265 | ||
1303 | 266 | /** | 266 | /** |
1304 | 267 | * Emitted when a buffer of data is ready to send to the | 267 | * Emitted when a buffer of data is ready to send to the |
1305 | 268 | * standard input of the terminal. | 268 | * standard input of the terminal. |
1306 | 269 | * | 269 | * |
1307 | 270 | * @param data The buffer of data ready to be sent | 270 | * @param data The buffer of data ready to be sent |
1308 | @@ -272,20 +272,20 @@ | |||
1309 | 272 | */ | 272 | */ |
1310 | 273 | void sendData(const char* data,int len); | 273 | void sendData(const char* data,int len); |
1311 | 274 | 274 | ||
1313 | 275 | /** | 275 | /** |
1314 | 276 | * Requests that sending of input to the emulation | 276 | * Requests that sending of input to the emulation |
1315 | 277 | * from the terminal process be suspended or resumed. | 277 | * from the terminal process be suspended or resumed. |
1316 | 278 | * | 278 | * |
1319 | 279 | * @param suspend If true, requests that sending of | 279 | * @param suspend If true, requests that sending of |
1320 | 280 | * input from the terminal process' stdout be | 280 | * input from the terminal process' stdout be |
1321 | 281 | * suspended. Otherwise requests that sending of | 281 | * suspended. Otherwise requests that sending of |
1323 | 282 | * input be resumed. | 282 | * input be resumed. |
1324 | 283 | */ | 283 | */ |
1325 | 284 | void lockPtyRequest(bool suspend); | 284 | void lockPtyRequest(bool suspend); |
1326 | 285 | 285 | ||
1327 | 286 | /** | 286 | /** |
1328 | 287 | * Requests that the pty used by the terminal process | 287 | * Requests that the pty used by the terminal process |
1330 | 288 | * be set to UTF 8 mode. | 288 | * be set to UTF 8 mode. |
1331 | 289 | * | 289 | * |
1332 | 290 | * TODO: More documentation | 290 | * TODO: More documentation |
1333 | 291 | */ | 291 | */ |
1334 | @@ -313,7 +313,7 @@ | |||
1335 | 313 | */ | 313 | */ |
1336 | 314 | void changeTabTextColorRequest(int color); | 314 | void changeTabTextColorRequest(int color); |
1337 | 315 | 315 | ||
1339 | 316 | /** | 316 | /** |
1340 | 317 | * This is emitted when the program running in the shell indicates whether or | 317 | * This is emitted when the program running in the shell indicates whether or |
1341 | 318 | * not it is interested in mouse events. | 318 | * not it is interested in mouse events. |
1342 | 319 | * | 319 | * |
1343 | @@ -322,7 +322,7 @@ | |||
1344 | 322 | */ | 322 | */ |
1345 | 323 | void programUsesMouseChanged(bool usesMouse); | 323 | void programUsesMouseChanged(bool usesMouse); |
1346 | 324 | 324 | ||
1348 | 325 | /** | 325 | /** |
1349 | 326 | * Emitted when the contents of the screen image change. | 326 | * Emitted when the contents of the screen image change. |
1350 | 327 | * The emulation buffers the updates from successive image changes, | 327 | * The emulation buffers the updates from successive image changes, |
1351 | 328 | * and only emits outputChanged() at sensible intervals when | 328 | * and only emits outputChanged() at sensible intervals when |
1352 | @@ -332,14 +332,14 @@ | |||
1353 | 332 | * created with createWindow() to listen for this signal. | 332 | * created with createWindow() to listen for this signal. |
1354 | 333 | * | 333 | * |
1355 | 334 | * ScreenWindow objects created using createWindow() will emit their | 334 | * ScreenWindow objects created using createWindow() will emit their |
1357 | 335 | * own outputChanged() signal in response to this signal. | 335 | * own outputChanged() signal in response to this signal. |
1358 | 336 | */ | 336 | */ |
1359 | 337 | void outputChanged(); | 337 | void outputChanged(); |
1360 | 338 | 338 | ||
1361 | 339 | /** | 339 | /** |
1363 | 340 | * Emitted when the program running in the terminal wishes to update the | 340 | * Emitted when the program running in the terminal wishes to update the |
1364 | 341 | * session's title. This also allows terminal programs to customize other | 341 | * session's title. This also allows terminal programs to customize other |
1366 | 342 | * aspects of the terminal emulation display. | 342 | * aspects of the terminal emulation display. |
1367 | 343 | * | 343 | * |
1368 | 344 | * This signal is emitted when the escape sequence "\033]ARG;VALUE\007" | 344 | * This signal is emitted when the escape sequence "\033]ARG;VALUE\007" |
1369 | 345 | * is received in the input string, where ARG is a number specifying what | 345 | * is received in the input string, where ARG is a number specifying what |
1370 | @@ -347,7 +347,7 @@ | |||
1371 | 347 | * | 347 | * |
1372 | 348 | * TODO: The name of this method is not very accurate since this method | 348 | * TODO: The name of this method is not very accurate since this method |
1373 | 349 | * is used to perform a whole range of tasks besides just setting | 349 | * is used to perform a whole range of tasks besides just setting |
1375 | 350 | * the user-title of the session. | 350 | * the user-title of the session. |
1376 | 351 | * | 351 | * |
1377 | 352 | * @param title Specifies what to change. | 352 | * @param title Specifies what to change. |
1378 | 353 | * <ul> | 353 | * <ul> |
1379 | @@ -356,16 +356,16 @@ | |||
1380 | 356 | * <li>2 - Set session title to @p newTitle</li> | 356 | * <li>2 - Set session title to @p newTitle</li> |
1381 | 357 | * <li>11 - Set the session's default background color to @p newTitle, | 357 | * <li>11 - Set the session's default background color to @p newTitle, |
1382 | 358 | * where @p newTitle can be an HTML-style string ("#RRGGBB") or a named | 358 | * where @p newTitle can be an HTML-style string ("#RRGGBB") or a named |
1384 | 359 | * color (eg 'red', 'blue'). | 359 | * color (eg 'red', 'blue'). |
1385 | 360 | * See http://doc.trolltech.com/4.2/qcolor.html#setNamedColor for more | 360 | * See http://doc.trolltech.com/4.2/qcolor.html#setNamedColor for more |
1386 | 361 | * details. | 361 | * details. |
1387 | 362 | * </li> | 362 | * </li> |
1388 | 363 | * <li>31 - Supposedly treats @p newTitle as a URL and opens it (NOT IMPLEMENTED)</li> | 363 | * <li>31 - Supposedly treats @p newTitle as a URL and opens it (NOT IMPLEMENTED)</li> |
1390 | 364 | * <li>32 - Sets the icon associated with the session. @p newTitle is the name | 364 | * <li>32 - Sets the icon associated with the session. @p newTitle is the name |
1391 | 365 | * of the icon to use, which can be the name of any icon in the current KDE icon | 365 | * of the icon to use, which can be the name of any icon in the current KDE icon |
1392 | 366 | * theme (eg: 'konsole', 'kate', 'folder_home')</li> | 366 | * theme (eg: 'konsole', 'kate', 'folder_home')</li> |
1393 | 367 | * </ul> | 367 | * </ul> |
1395 | 368 | * @param newTitle Specifies the new title | 368 | * @param newTitle Specifies the new title |
1396 | 369 | */ | 369 | */ |
1397 | 370 | 370 | ||
1398 | 371 | void titleChanged(int title,const QString& newTitle); | 371 | void titleChanged(int title,const QString& newTitle); |
1399 | @@ -376,9 +376,9 @@ | |||
1400 | 376 | */ | 376 | */ |
1401 | 377 | void imageSizeChanged(int lineCount , int columnCount); | 377 | void imageSizeChanged(int lineCount , int columnCount); |
1402 | 378 | 378 | ||
1404 | 379 | /** | 379 | /** |
1405 | 380 | * Emitted when the terminal program requests to change various properties | 380 | * Emitted when the terminal program requests to change various properties |
1407 | 381 | * of the terminal display. | 381 | * of the terminal display. |
1408 | 382 | * | 382 | * |
1409 | 383 | * A profile change command occurs when a special escape sequence, followed | 383 | * A profile change command occurs when a special escape sequence, followed |
1410 | 384 | * by a string containing a series of name and value pairs is received. | 384 | * by a string containing a series of name and value pairs is received. |
1411 | @@ -389,7 +389,7 @@ | |||
1412 | 389 | */ | 389 | */ |
1413 | 390 | void profileChangeCommandReceived(const QString& text); | 390 | void profileChangeCommandReceived(const QString& text); |
1414 | 391 | 391 | ||
1416 | 392 | /** | 392 | /** |
1417 | 393 | * Emitted when a flow control key combination ( Ctrl+S or Ctrl+Q ) is pressed. | 393 | * Emitted when a flow control key combination ( Ctrl+S or Ctrl+Q ) is pressed. |
1418 | 394 | * @param suspendKeyPressed True if Ctrl+S was pressed to suspend output or Ctrl+Q to | 394 | * @param suspendKeyPressed True if Ctrl+S was pressed to suspend output or Ctrl+Q to |
1419 | 395 | * resume output. | 395 | * resume output. |
1420 | @@ -399,21 +399,21 @@ | |||
1421 | 399 | protected: | 399 | protected: |
1422 | 400 | virtual void setMode(int mode) = 0; | 400 | virtual void setMode(int mode) = 0; |
1423 | 401 | virtual void resetMode(int mode) = 0; | 401 | virtual void resetMode(int mode) = 0; |
1426 | 402 | 402 | ||
1427 | 403 | /** | 403 | /** |
1428 | 404 | * Processes an incoming character. See receiveData() | 404 | * Processes an incoming character. See receiveData() |
1430 | 405 | * @p ch A unicode character code. | 405 | * @p ch A unicode character code. |
1431 | 406 | */ | 406 | */ |
1432 | 407 | virtual void receiveChar(int ch); | 407 | virtual void receiveChar(int ch); |
1433 | 408 | 408 | ||
1435 | 409 | /** | 409 | /** |
1436 | 410 | * Sets the active screen. The terminal has two screens, primary and alternate. | 410 | * Sets the active screen. The terminal has two screens, primary and alternate. |
1437 | 411 | * The primary screen is used by default. When certain interactive programs such | 411 | * The primary screen is used by default. When certain interactive programs such |
1438 | 412 | * as Vim are run, they trigger a switch to the alternate screen. | 412 | * as Vim are run, they trigger a switch to the alternate screen. |
1439 | 413 | * | 413 | * |
1440 | 414 | * @param index 0 to switch to the primary screen, or 1 to switch to the alternate screen | 414 | * @param index 0 to switch to the primary screen, or 1 to switch to the alternate screen |
1441 | 415 | */ | 415 | */ |
1443 | 416 | void setScreen(int index); | 416 | void setScreen(int index); |
1444 | 417 | 417 | ||
1445 | 418 | enum EmulationCodec | 418 | enum EmulationCodec |
1446 | 419 | { | 419 | { |
1447 | @@ -424,35 +424,35 @@ | |||
1448 | 424 | 424 | ||
1449 | 425 | 425 | ||
1450 | 426 | QList<ScreenWindow*> _windows; | 426 | QList<ScreenWindow*> _windows; |
1453 | 427 | 427 | ||
1454 | 428 | Screen* _currentScreen; // pointer to the screen which is currently active, | 428 | Screen* _currentScreen; // pointer to the screen which is currently active, |
1455 | 429 | // this is one of the elements in the screen[] array | 429 | // this is one of the elements in the screen[] array |
1456 | 430 | 430 | ||
1457 | 431 | Screen* _screen[2]; // 0 = primary screen ( used by most programs, including the shell | 431 | Screen* _screen[2]; // 0 = primary screen ( used by most programs, including the shell |
1458 | 432 | // scrollbars are enabled in this mode ) | 432 | // scrollbars are enabled in this mode ) |
1459 | 433 | // 1 = alternate ( used by vi , emacs etc. | 433 | // 1 = alternate ( used by vi , emacs etc. |
1460 | 434 | // scrollbars are not enabled in this mode ) | 434 | // scrollbars are not enabled in this mode ) |
1464 | 435 | 435 | ||
1465 | 436 | 436 | ||
1466 | 437 | //decodes an incoming C-style character stream into a unicode QString using | 437 | //decodes an incoming C-style character stream into a unicode QString using |
1467 | 438 | //the current text codec. (this allows for rendering of non-ASCII characters in text files etc.) | 438 | //the current text codec. (this allows for rendering of non-ASCII characters in text files etc.) |
1468 | 439 | const QTextCodec* _codec; | 439 | const QTextCodec* _codec; |
1469 | 440 | QTextDecoder* _decoder; | 440 | QTextDecoder* _decoder; |
1470 | 441 | const KeyboardTranslator* _keyTranslator; // the keyboard layout | 441 | const KeyboardTranslator* _keyTranslator; // the keyboard layout |
1471 | 442 | 442 | ||
1472 | 443 | protected slots: | 443 | protected slots: |
1474 | 444 | /** | 444 | /** |
1475 | 445 | * Schedules an update of attached views. | 445 | * Schedules an update of attached views. |
1476 | 446 | * Repeated calls to bufferedUpdate() in close succession will result in only a single update, | 446 | * Repeated calls to bufferedUpdate() in close succession will result in only a single update, |
1478 | 447 | * much like the Qt buffered update of widgets. | 447 | * much like the Qt buffered update of widgets. |
1479 | 448 | */ | 448 | */ |
1480 | 449 | void bufferedUpdate(); | 449 | void bufferedUpdate(); |
1481 | 450 | 450 | ||
1483 | 451 | private slots: | 451 | private slots: |
1484 | 452 | 452 | ||
1485 | 453 | // triggered by timer, causes the emulation to send an updated screen image to each | 453 | // triggered by timer, causes the emulation to send an updated screen image to each |
1486 | 454 | // view | 454 | // view |
1488 | 455 | void showBulk(); | 455 | void showBulk(); |
1489 | 456 | 456 | ||
1490 | 457 | void usesMouseChanged(bool usesMouse); | 457 | void usesMouseChanged(bool usesMouse); |
1491 | 458 | 458 | ||
1492 | @@ -460,7 +460,7 @@ | |||
1493 | 460 | bool _usesMouse; | 460 | bool _usesMouse; |
1494 | 461 | QTimer _bulkTimer1; | 461 | QTimer _bulkTimer1; |
1495 | 462 | QTimer _bulkTimer2; | 462 | QTimer _bulkTimer2; |
1497 | 463 | 463 | ||
1498 | 464 | }; | 464 | }; |
1499 | 465 | 465 | ||
1500 | 466 | 466 | ||
1501 | 467 | 467 | ||
1502 | === modified file 'src/plugin/konsole/Filter.cpp' | |||
1503 | --- src/plugin/konsole/Filter.cpp 2014-04-27 09:11:14 +0000 | |||
1504 | +++ src/plugin/konsole/Filter.cpp 2014-07-30 09:50:10 +0000 | |||
1505 | @@ -46,7 +46,7 @@ | |||
1506 | 46 | FilterChain::~FilterChain() | 46 | FilterChain::~FilterChain() |
1507 | 47 | { | 47 | { |
1508 | 48 | QMutableListIterator<Filter*> iter(*this); | 48 | QMutableListIterator<Filter*> iter(*this); |
1510 | 49 | 49 | ||
1511 | 50 | while ( iter.hasNext() ) | 50 | while ( iter.hasNext() ) |
1512 | 51 | { | 51 | { |
1513 | 52 | Filter* filter = iter.next(); | 52 | Filter* filter = iter.next(); |
1514 | @@ -140,7 +140,7 @@ | |||
1515 | 140 | 140 | ||
1516 | 141 | PlainTextDecoder decoder; | 141 | PlainTextDecoder decoder; |
1517 | 142 | decoder.setTrailingWhitespace(false); | 142 | decoder.setTrailingWhitespace(false); |
1519 | 143 | 143 | ||
1520 | 144 | // setup new shared buffers for the filters to process on | 144 | // setup new shared buffers for the filters to process on |
1521 | 145 | QString* newBuffer = new QString(); | 145 | QString* newBuffer = new QString(); |
1522 | 146 | QList<int>* newLinePositions = new QList<int>(); | 146 | QList<int>* newLinePositions = new QList<int>(); |
1523 | @@ -166,7 +166,7 @@ | |||
1524 | 166 | // being treated as part of a link that occurs at the start of the next line | 166 | // being treated as part of a link that occurs at the start of the next line |
1525 | 167 | // | 167 | // |
1526 | 168 | // the downside is that links which are spread over more than one line are not | 168 | // the downside is that links which are spread over more than one line are not |
1528 | 169 | // highlighted. | 169 | // highlighted. |
1529 | 170 | // | 170 | // |
1530 | 171 | // TODO - Use the "line wrapped" attribute associated with lines in a | 171 | // TODO - Use the "line wrapped" attribute associated with lines in a |
1531 | 172 | // terminal image to avoid adding this imaginary character for wrapped | 172 | // terminal image to avoid adding this imaginary character for wrapped |
1532 | @@ -218,7 +218,7 @@ | |||
1533 | 218 | else | 218 | else |
1534 | 219 | nextLine = _linePositions->value(i+1); | 219 | nextLine = _linePositions->value(i+1); |
1535 | 220 | 220 | ||
1537 | 221 | if ( _linePositions->value(i) <= position && position < nextLine ) | 221 | if ( _linePositions->value(i) <= position && position < nextLine ) |
1538 | 222 | { | 222 | { |
1539 | 223 | startLine = i; | 223 | startLine = i; |
1540 | 224 | startColumn = string_width(buffer()->mid(_linePositions->value(i),position - _linePositions->value(i))); | 224 | startColumn = string_width(buffer()->mid(_linePositions->value(i),position - _linePositions->value(i))); |
1541 | @@ -226,7 +226,7 @@ | |||
1542 | 226 | } | 226 | } |
1543 | 227 | } | 227 | } |
1544 | 228 | } | 228 | } |
1546 | 229 | 229 | ||
1547 | 230 | 230 | ||
1548 | 231 | /*void Filter::addLine(const QString& text) | 231 | /*void Filter::addLine(const QString& text) |
1549 | 232 | { | 232 | { |
1550 | @@ -248,7 +248,7 @@ | |||
1551 | 248 | for (int line = spot->startLine() ; line <= spot->endLine() ; line++) | 248 | for (int line = spot->startLine() ; line <= spot->endLine() ; line++) |
1552 | 249 | { | 249 | { |
1553 | 250 | _hotspots.insert(line,spot); | 250 | _hotspots.insert(line,spot); |
1555 | 251 | } | 251 | } |
1556 | 252 | } | 252 | } |
1557 | 253 | QList<Filter::HotSpot*> Filter::hotSpots() const | 253 | QList<Filter::HotSpot*> Filter::hotSpots() const |
1558 | 254 | { | 254 | { |
1559 | @@ -266,12 +266,12 @@ | |||
1560 | 266 | while (spotIter.hasNext()) | 266 | while (spotIter.hasNext()) |
1561 | 267 | { | 267 | { |
1562 | 268 | HotSpot* spot = spotIter.next(); | 268 | HotSpot* spot = spotIter.next(); |
1564 | 269 | 269 | ||
1565 | 270 | if ( spot->startLine() == line && spot->startColumn() > column ) | 270 | if ( spot->startLine() == line && spot->startColumn() > column ) |
1566 | 271 | continue; | 271 | continue; |
1567 | 272 | if ( spot->endLine() == line && spot->endColumn() < column ) | 272 | if ( spot->endLine() == line && spot->endColumn() < column ) |
1568 | 273 | continue; | 273 | continue; |
1570 | 274 | 274 | ||
1571 | 275 | return spot; | 275 | return spot; |
1572 | 276 | } | 276 | } |
1573 | 277 | 277 | ||
1574 | @@ -342,7 +342,7 @@ | |||
1575 | 342 | return _capturedTexts; | 342 | return _capturedTexts; |
1576 | 343 | } | 343 | } |
1577 | 344 | 344 | ||
1579 | 345 | void RegExpFilter::setRegExp(const QRegExp& regExp) | 345 | void RegExpFilter::setRegExp(const QRegExp& regExp) |
1580 | 346 | { | 346 | { |
1581 | 347 | _searchText = regExp; | 347 | _searchText = regExp; |
1582 | 348 | } | 348 | } |
1583 | @@ -385,14 +385,14 @@ | |||
1584 | 385 | endLine,endColumn); | 385 | endLine,endColumn); |
1585 | 386 | spot->setCapturedTexts(_searchText.capturedTexts()); | 386 | spot->setCapturedTexts(_searchText.capturedTexts()); |
1586 | 387 | 387 | ||
1588 | 388 | addHotSpot( spot ); | 388 | addHotSpot( spot ); |
1589 | 389 | pos += _searchText.matchedLength(); | 389 | pos += _searchText.matchedLength(); |
1590 | 390 | 390 | ||
1591 | 391 | // if matchedLength == 0, the program will get stuck in an infinite loop | 391 | // if matchedLength == 0, the program will get stuck in an infinite loop |
1592 | 392 | if ( _searchText.matchedLength() == 0 ) | 392 | if ( _searchText.matchedLength() == 0 ) |
1593 | 393 | pos = -1; | 393 | pos = -1; |
1594 | 394 | } | 394 | } |
1596 | 395 | } | 395 | } |
1597 | 396 | } | 396 | } |
1598 | 397 | 397 | ||
1599 | 398 | RegExpFilter::HotSpot* RegExpFilter::newHotSpot(int startLine,int startColumn, | 398 | RegExpFilter::HotSpot* RegExpFilter::newHotSpot(int startLine,int startColumn, |
1600 | @@ -420,16 +420,16 @@ | |||
1601 | 420 | const UrlType kind = urlType(); | 420 | const UrlType kind = urlType(); |
1602 | 421 | 421 | ||
1603 | 422 | if ( kind == StandardUrl ) | 422 | if ( kind == StandardUrl ) |
1605 | 423 | return QString(); | 423 | return QString(); |
1606 | 424 | else if ( kind == Email ) | 424 | else if ( kind == Email ) |
1608 | 425 | return QString(); | 425 | return QString(); |
1609 | 426 | else | 426 | else |
1610 | 427 | return QString(); | 427 | return QString(); |
1611 | 428 | } | 428 | } |
1612 | 429 | UrlFilter::HotSpot::UrlType UrlFilter::HotSpot::urlType() const | 429 | UrlFilter::HotSpot::UrlType UrlFilter::HotSpot::urlType() const |
1613 | 430 | { | 430 | { |
1614 | 431 | QString url = capturedTexts().first(); | 431 | QString url = capturedTexts().first(); |
1616 | 432 | 432 | ||
1617 | 433 | if ( FullUrlRegExp.exactMatch(url) ) | 433 | if ( FullUrlRegExp.exactMatch(url) ) |
1618 | 434 | return StandardUrl; | 434 | return StandardUrl; |
1619 | 435 | else if ( EmailAddressRegExp.exactMatch(url) ) | 435 | else if ( EmailAddressRegExp.exactMatch(url) ) |
1620 | @@ -462,24 +462,24 @@ | |||
1621 | 462 | { | 462 | { |
1622 | 463 | url.prepend("http://"); | 463 | url.prepend("http://"); |
1623 | 464 | } | 464 | } |
1625 | 465 | } | 465 | } |
1626 | 466 | else if ( kind == Email ) | 466 | else if ( kind == Email ) |
1627 | 467 | { | 467 | { |
1628 | 468 | url.prepend("mailto:"); | 468 | url.prepend("mailto:"); |
1629 | 469 | } | 469 | } |
1631 | 470 | 470 | ||
1632 | 471 | QDesktopServices::openUrl(QUrl(url)); | 471 | QDesktopServices::openUrl(QUrl(url)); |
1633 | 472 | //new KRun(url,QApplication::activeWindow()); | 472 | //new KRun(url,QApplication::activeWindow()); |
1634 | 473 | } | 473 | } |
1635 | 474 | } | 474 | } |
1636 | 475 | 475 | ||
1638 | 476 | // Note: Altering these regular expressions can have a major effect on the performance of the filters | 476 | // Note: Altering these regular expressions can have a major effect on the performance of the filters |
1639 | 477 | // used for finding URLs in the text, especially if they are very general and could match very long | 477 | // used for finding URLs in the text, especially if they are very general and could match very long |
1640 | 478 | // pieces of text. | 478 | // pieces of text. |
1641 | 479 | // Please be careful when altering them. | 479 | // Please be careful when altering them. |
1642 | 480 | 480 | ||
1643 | 481 | //regexp matches: | 481 | //regexp matches: |
1645 | 482 | // full url: | 482 | // full url: |
1646 | 483 | // protocolname:// or www. followed by anything other than whitespaces, <, >, ' or ", and ends before whitespaces, <, >, ', ", ], !, comma and dot | 483 | // protocolname:// or www. followed by anything other than whitespaces, <, >, ' or ", and ends before whitespaces, <, >, ', ", ], !, comma and dot |
1647 | 484 | const QRegExp UrlFilter::FullUrlRegExp("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]]"); | 484 | const QRegExp UrlFilter::FullUrlRegExp("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]]"); |
1648 | 485 | // email address: | 485 | // email address: |
1649 | @@ -536,7 +536,7 @@ | |||
1650 | 536 | list << openAction; | 536 | list << openAction; |
1651 | 537 | list << copyAction; | 537 | list << copyAction; |
1652 | 538 | 538 | ||
1654 | 539 | return list; | 539 | return list; |
1655 | 540 | } | 540 | } |
1656 | 541 | 541 | ||
1657 | 542 | //#include "Filter.moc" | 542 | //#include "Filter.moc" |
1658 | 543 | 543 | ||
1659 | === modified file 'src/plugin/konsole/Filter.h' | |||
1660 | --- src/plugin/konsole/Filter.h 2014-04-27 09:11:14 +0000 | |||
1661 | +++ src/plugin/konsole/Filter.h 2014-07-30 09:50:10 +0000 | |||
1662 | @@ -42,7 +42,7 @@ | |||
1663 | 42 | * activate() method should be called. Depending on the type of hotspot this will trigger a suitable response. | 42 | * activate() method should be called. Depending on the type of hotspot this will trigger a suitable response. |
1664 | 43 | * | 43 | * |
1665 | 44 | * For example, if a hotspot represents a URL then a suitable action would be opening that URL in a web browser. | 44 | * For example, if a hotspot represents a URL then a suitable action would be opening that URL in a web browser. |
1667 | 45 | * Hotspots may have more than one action, in which case the list of actions can be obtained using the | 45 | * Hotspots may have more than one action, in which case the list of actions can be obtained using the |
1668 | 46 | * actions() method. | 46 | * actions() method. |
1669 | 47 | * | 47 | * |
1670 | 48 | * Different subclasses of filter will return different types of hotspot. | 48 | * Different subclasses of filter will return different types of hotspot. |
1671 | @@ -62,13 +62,13 @@ | |||
1672 | 62 | * activate() method should be called. Depending on the type of hotspot this will trigger a suitable response. | 62 | * activate() method should be called. Depending on the type of hotspot this will trigger a suitable response. |
1673 | 63 | * | 63 | * |
1674 | 64 | * For example, if a hotspot represents a URL then a suitable action would be opening that URL in a web browser. | 64 | * For example, if a hotspot represents a URL then a suitable action would be opening that URL in a web browser. |
1677 | 65 | * Hotspots may have more than one action, in which case the list of actions can be obtained using the | 65 | * Hotspots may have more than one action, in which case the list of actions can be obtained using the |
1678 | 66 | * actions() method. These actions may then be displayed in a popup menu or toolbar for example. | 66 | * actions() method. These actions may then be displayed in a popup menu or toolbar for example. |
1679 | 67 | */ | 67 | */ |
1680 | 68 | class HotSpot | 68 | class HotSpot |
1681 | 69 | { | 69 | { |
1682 | 70 | public: | 70 | public: |
1684 | 71 | /** | 71 | /** |
1685 | 72 | * Constructs a new hotspot which covers the area from (@p startLine,@p startColumn) to (@p endLine,@p endColumn) | 72 | * Constructs a new hotspot which covers the area from (@p startLine,@p startColumn) to (@p endLine,@p endColumn) |
1686 | 73 | * in a block of text. | 73 | * in a block of text. |
1687 | 74 | */ | 74 | */ |
1688 | @@ -83,7 +83,7 @@ | |||
1689 | 83 | Link, | 83 | Link, |
1690 | 84 | // this hotspot represents a marker | 84 | // this hotspot represents a marker |
1691 | 85 | Marker | 85 | Marker |
1693 | 86 | }; | 86 | }; |
1694 | 87 | 87 | ||
1695 | 88 | /** Returns the line when the hotspot area starts */ | 88 | /** Returns the line when the hotspot area starts */ |
1696 | 89 | int startLine() const; | 89 | int startLine() const; |
1697 | @@ -93,31 +93,31 @@ | |||
1698 | 93 | int startColumn() const; | 93 | int startColumn() const; |
1699 | 94 | /** Returns the column on endLine() where the hotspot area ends */ | 94 | /** Returns the column on endLine() where the hotspot area ends */ |
1700 | 95 | int endColumn() const; | 95 | int endColumn() const; |
1702 | 96 | /** | 96 | /** |
1703 | 97 | * Returns the type of the hotspot. This is usually used as a hint for views on how to represent | 97 | * Returns the type of the hotspot. This is usually used as a hint for views on how to represent |
1704 | 98 | * the hotspot graphically. eg. Link hotspots are typically underlined when the user mouses over them | 98 | * the hotspot graphically. eg. Link hotspots are typically underlined when the user mouses over them |
1705 | 99 | */ | 99 | */ |
1706 | 100 | Type type() const; | 100 | Type type() const; |
1709 | 101 | /** | 101 | /** |
1710 | 102 | * Causes the an action associated with a hotspot to be triggered. | 102 | * Causes the an action associated with a hotspot to be triggered. |
1711 | 103 | * | 103 | * |
1712 | 104 | * @param object The object which caused the hotspot to be triggered. This is | 104 | * @param object The object which caused the hotspot to be triggered. This is |
1713 | 105 | * typically null ( in which case the default action should be performed ) or | 105 | * typically null ( in which case the default action should be performed ) or |
1714 | 106 | * one of the objects from the actions() list. In which case the associated | 106 | * one of the objects from the actions() list. In which case the associated |
1716 | 107 | * action should be performed. | 107 | * action should be performed. |
1717 | 108 | */ | 108 | */ |
1722 | 109 | virtual void activate(QObject* object = 0) = 0; | 109 | virtual void activate(QObject* object = 0) = 0; |
1723 | 110 | /** | 110 | /** |
1724 | 111 | * Returns a list of actions associated with the hotspot which can be used in a | 111 | * Returns a list of actions associated with the hotspot which can be used in a |
1725 | 112 | * menu or toolbar | 112 | * menu or toolbar |
1726 | 113 | */ | 113 | */ |
1727 | 114 | virtual QList<QAction*> actions(); | 114 | virtual QList<QAction*> actions(); |
1728 | 115 | 115 | ||
1730 | 116 | /** | 116 | /** |
1731 | 117 | * Returns the text of a tooltip to be shown when the mouse moves over the hotspot, or | 117 | * Returns the text of a tooltip to be shown when the mouse moves over the hotspot, or |
1732 | 118 | * an empty string if there is no tooltip associated with this hotspot. | 118 | * an empty string if there is no tooltip associated with this hotspot. |
1733 | 119 | * | 119 | * |
1735 | 120 | * The default implementation returns an empty string. | 120 | * The default implementation returns an empty string. |
1736 | 121 | */ | 121 | */ |
1737 | 122 | virtual QString tooltip() const; | 122 | virtual QString tooltip() const; |
1738 | 123 | 123 | ||
1739 | @@ -131,7 +131,7 @@ | |||
1740 | 131 | int _endLine; | 131 | int _endLine; |
1741 | 132 | int _endColumn; | 132 | int _endColumn; |
1742 | 133 | Type _type; | 133 | Type _type; |
1744 | 134 | 134 | ||
1745 | 135 | }; | 135 | }; |
1746 | 136 | 136 | ||
1747 | 137 | /** Constructs a new filter. */ | 137 | /** Constructs a new filter. */ |
1748 | @@ -141,9 +141,9 @@ | |||
1749 | 141 | /** Causes the filter to process the block of text currently in its internal buffer */ | 141 | /** Causes the filter to process the block of text currently in its internal buffer */ |
1750 | 142 | virtual void process() = 0; | 142 | virtual void process() = 0; |
1751 | 143 | 143 | ||
1753 | 144 | /** | 144 | /** |
1754 | 145 | * Empties the filters internal buffer and resets the line count back to 0. | 145 | * Empties the filters internal buffer and resets the line count back to 0. |
1756 | 146 | * All hotspots are deleted. | 146 | * All hotspots are deleted. |
1757 | 147 | */ | 147 | */ |
1758 | 148 | void reset(); | 148 | void reset(); |
1759 | 149 | 149 | ||
1760 | @@ -159,7 +159,7 @@ | |||
1761 | 159 | /** Returns the list of hotspots identified by the filter which occur on a given line */ | 159 | /** Returns the list of hotspots identified by the filter which occur on a given line */ |
1762 | 160 | QList<HotSpot*> hotSpotsAtLine(int line) const; | 160 | QList<HotSpot*> hotSpotsAtLine(int line) const; |
1763 | 161 | 161 | ||
1765 | 162 | /** | 162 | /** |
1766 | 163 | * TODO: Document me | 163 | * TODO: Document me |
1767 | 164 | */ | 164 | */ |
1768 | 165 | void setBuffer(const QString* buffer , const QList<int>* linePositions); | 165 | void setBuffer(const QString* buffer , const QList<int>* linePositions); |
1769 | @@ -175,22 +175,22 @@ | |||
1770 | 175 | private: | 175 | private: |
1771 | 176 | QMultiHash<int,HotSpot*> _hotspots; | 176 | QMultiHash<int,HotSpot*> _hotspots; |
1772 | 177 | QList<HotSpot*> _hotspotList; | 177 | QList<HotSpot*> _hotspotList; |
1774 | 178 | 178 | ||
1775 | 179 | const QList<int>* _linePositions; | 179 | const QList<int>* _linePositions; |
1776 | 180 | const QString* _buffer; | 180 | const QString* _buffer; |
1777 | 181 | }; | 181 | }; |
1778 | 182 | 182 | ||
1781 | 183 | /** | 183 | /** |
1782 | 184 | * A filter which searches for sections of text matching a regular expression and creates a new RegExpFilter::HotSpot | 184 | * A filter which searches for sections of text matching a regular expression and creates a new RegExpFilter::HotSpot |
1783 | 185 | * instance for them. | 185 | * instance for them. |
1784 | 186 | * | 186 | * |
1785 | 187 | * Subclasses can reimplement newHotSpot() to return custom hotspot types when matches for the regular expression | 187 | * Subclasses can reimplement newHotSpot() to return custom hotspot types when matches for the regular expression |
1787 | 188 | * are found. | 188 | * are found. |
1788 | 189 | */ | 189 | */ |
1789 | 190 | class RegExpFilter : public Filter | 190 | class RegExpFilter : public Filter |
1790 | 191 | { | 191 | { |
1791 | 192 | public: | 192 | public: |
1793 | 193 | /** | 193 | /** |
1794 | 194 | * Type of hotspot created by RegExpFilter. The capturedTexts() method can be used to find the text | 194 | * Type of hotspot created by RegExpFilter. The capturedTexts() method can be used to find the text |
1795 | 195 | * matched by the filter's regular expression. | 195 | * matched by the filter's regular expression. |
1796 | 196 | */ | 196 | */ |
1797 | @@ -211,26 +211,26 @@ | |||
1798 | 211 | /** Constructs a new regular expression filter */ | 211 | /** Constructs a new regular expression filter */ |
1799 | 212 | RegExpFilter(); | 212 | RegExpFilter(); |
1800 | 213 | 213 | ||
1803 | 214 | /** | 214 | /** |
1804 | 215 | * Sets the regular expression which the filter searches for in blocks of text. | 215 | * Sets the regular expression which the filter searches for in blocks of text. |
1805 | 216 | * | 216 | * |
1806 | 217 | * Regular expressions which match the empty string are treated as not matching | 217 | * Regular expressions which match the empty string are treated as not matching |
1808 | 218 | * anything. | 218 | * anything. |
1809 | 219 | */ | 219 | */ |
1810 | 220 | void setRegExp(const QRegExp& text); | 220 | void setRegExp(const QRegExp& text); |
1811 | 221 | /** Returns the regular expression which the filter searches for in blocks of text */ | 221 | /** Returns the regular expression which the filter searches for in blocks of text */ |
1812 | 222 | QRegExp regExp() const; | 222 | QRegExp regExp() const; |
1813 | 223 | 223 | ||
1816 | 224 | /** | 224 | /** |
1817 | 225 | * Reimplemented to search the filter's text buffer for text matching regExp() | 225 | * Reimplemented to search the filter's text buffer for text matching regExp() |
1818 | 226 | * | 226 | * |
1819 | 227 | * If regexp matches the empty string, then process() will return immediately | 227 | * If regexp matches the empty string, then process() will return immediately |
1821 | 228 | * without finding results. | 228 | * without finding results. |
1822 | 229 | */ | 229 | */ |
1823 | 230 | virtual void process(); | 230 | virtual void process(); |
1824 | 231 | 231 | ||
1825 | 232 | protected: | 232 | protected: |
1827 | 233 | /** | 233 | /** |
1828 | 234 | * Called when a match for the regular expression is encountered. Subclasses should reimplement this | 234 | * Called when a match for the regular expression is encountered. Subclasses should reimplement this |
1829 | 235 | * to return custom hotspot types | 235 | * to return custom hotspot types |
1830 | 236 | */ | 236 | */ |
1831 | @@ -244,14 +244,14 @@ | |||
1832 | 244 | class FilterObject; | 244 | class FilterObject; |
1833 | 245 | 245 | ||
1834 | 246 | /** A filter which matches URLs in blocks of text */ | 246 | /** A filter which matches URLs in blocks of text */ |
1836 | 247 | class UrlFilter : public RegExpFilter | 247 | class UrlFilter : public RegExpFilter |
1837 | 248 | { | 248 | { |
1838 | 249 | public: | 249 | public: |
1841 | 250 | /** | 250 | /** |
1842 | 251 | * Hotspot type created by UrlFilter instances. The activate() method opens a web browser | 251 | * Hotspot type created by UrlFilter instances. The activate() method opens a web browser |
1843 | 252 | * at the given URL when called. | 252 | * at the given URL when called. |
1844 | 253 | */ | 253 | */ |
1846 | 254 | class HotSpot : public RegExpFilter::HotSpot | 254 | class HotSpot : public RegExpFilter::HotSpot |
1847 | 255 | { | 255 | { |
1848 | 256 | public: | 256 | public: |
1849 | 257 | HotSpot(int startLine,int startColumn,int endLine,int endColumn); | 257 | HotSpot(int startLine,int startColumn,int endLine,int endColumn); |
1850 | @@ -259,7 +259,7 @@ | |||
1851 | 259 | 259 | ||
1852 | 260 | virtual QList<QAction*> actions(); | 260 | virtual QList<QAction*> actions(); |
1853 | 261 | 261 | ||
1855 | 262 | /** | 262 | /** |
1856 | 263 | * Open a web browser at the current URL. The url itself can be determined using | 263 | * Open a web browser at the current URL. The url itself can be determined using |
1857 | 264 | * the capturedTexts() method. | 264 | * the capturedTexts() method. |
1858 | 265 | */ | 265 | */ |
1859 | @@ -284,12 +284,12 @@ | |||
1860 | 284 | virtual RegExpFilter::HotSpot* newHotSpot(int,int,int,int); | 284 | virtual RegExpFilter::HotSpot* newHotSpot(int,int,int,int); |
1861 | 285 | 285 | ||
1862 | 286 | private: | 286 | private: |
1864 | 287 | 287 | ||
1865 | 288 | static const QRegExp FullUrlRegExp; | 288 | static const QRegExp FullUrlRegExp; |
1866 | 289 | static const QRegExp EmailAddressRegExp; | 289 | static const QRegExp EmailAddressRegExp; |
1867 | 290 | 290 | ||
1868 | 291 | // combined OR of FullUrlRegExp and EmailAddressRegExp | 291 | // combined OR of FullUrlRegExp and EmailAddressRegExp |
1870 | 292 | static const QRegExp CompleteUrlRegExp; | 292 | static const QRegExp CompleteUrlRegExp; |
1871 | 293 | }; | 293 | }; |
1872 | 294 | 294 | ||
1873 | 295 | class FilterObject : public QObject | 295 | class FilterObject : public QObject |
1874 | @@ -303,11 +303,11 @@ | |||
1875 | 303 | Filter::HotSpot* _filter; | 303 | Filter::HotSpot* _filter; |
1876 | 304 | }; | 304 | }; |
1877 | 305 | 305 | ||
1880 | 306 | /** | 306 | /** |
1881 | 307 | * A chain which allows a group of filters to be processed as one. | 307 | * A chain which allows a group of filters to be processed as one. |
1882 | 308 | * The chain owns the filters added to it and deletes them when the chain itself is destroyed. | 308 | * The chain owns the filters added to it and deletes them when the chain itself is destroyed. |
1883 | 309 | * | 309 | * |
1885 | 310 | * Use addFilter() to add a new filter to the chain. | 310 | * Use addFilter() to add a new filter to the chain. |
1886 | 311 | * When new text to be filtered arrives, use addLine() to add each additional | 311 | * When new text to be filtered arrives, use addLine() to add each additional |
1887 | 312 | * line of text which needs to be processed and then after adding the last line, use | 312 | * line of text which needs to be processed and then after adding the last line, use |
1888 | 313 | * process() to cause each filter in the chain to process the text. | 313 | * process() to cause each filter in the chain to process the text. |
1889 | @@ -337,12 +337,12 @@ | |||
1890 | 337 | /** Resets each filter in the chain */ | 337 | /** Resets each filter in the chain */ |
1891 | 338 | void reset(); | 338 | void reset(); |
1892 | 339 | /** | 339 | /** |
1894 | 340 | * Processes each filter in the chain | 340 | * Processes each filter in the chain |
1895 | 341 | */ | 341 | */ |
1896 | 342 | void process(); | 342 | void process(); |
1897 | 343 | 343 | ||
1898 | 344 | /** Sets the buffer for each filter in the chain to process. */ | 344 | /** Sets the buffer for each filter in the chain to process. */ |
1900 | 345 | void setBuffer(const QString* buffer , const QList<int>* linePositions); | 345 | void setBuffer(const QString* buffer , const QList<int>* linePositions); |
1901 | 346 | 346 | ||
1902 | 347 | /** Returns the first hotspot which occurs at @p line, @p column or 0 if no hotspot was found */ | 347 | /** Returns the first hotspot which occurs at @p line, @p column or 0 if no hotspot was found */ |
1903 | 348 | Filter::HotSpot* hotSpotAt(int line , int column) const; | 348 | Filter::HotSpot* hotSpotAt(int line , int column) const; |
1904 | @@ -369,7 +369,7 @@ | |||
1905 | 369 | * @param lineProperties The line properties to set for image | 369 | * @param lineProperties The line properties to set for image |
1906 | 370 | */ | 370 | */ |
1907 | 371 | void setImage(const Character* const image , int lines , int columns, | 371 | void setImage(const Character* const image , int lines , int columns, |
1909 | 372 | const QVector<LineProperty>& lineProperties); | 372 | const QVector<LineProperty>& lineProperties); |
1910 | 373 | 373 | ||
1911 | 374 | private: | 374 | private: |
1912 | 375 | QString* _buffer; | 375 | QString* _buffer; |
1913 | 376 | 376 | ||
1914 | === modified file 'src/plugin/konsole/History.cpp' | |||
1915 | --- src/plugin/konsole/History.cpp 2014-04-27 09:11:14 +0000 | |||
1916 | +++ src/plugin/konsole/History.cpp 2014-07-30 09:50:10 +0000 | |||
1917 | @@ -92,7 +92,7 @@ | |||
1918 | 92 | fileMap(0) | 92 | fileMap(0) |
1919 | 93 | { | 93 | { |
1920 | 94 | if (tmpFile.open()) | 94 | if (tmpFile.open()) |
1922 | 95 | { | 95 | { |
1923 | 96 | tmpFile.setAutoRemove(true); | 96 | tmpFile.setAutoRemove(true); |
1924 | 97 | ion = tmpFile.handle(); | 97 | ion = tmpFile.handle(); |
1925 | 98 | } | 98 | } |
1926 | @@ -116,7 +116,7 @@ | |||
1927 | 116 | //if mmap'ing fails, fall back to the read-lseek combination | 116 | //if mmap'ing fails, fall back to the read-lseek combination |
1928 | 117 | if ( fileMap == MAP_FAILED ) | 117 | if ( fileMap == MAP_FAILED ) |
1929 | 118 | { | 118 | { |
1931 | 119 | readWriteBalance = 0; | 119 | readWriteBalance = 0; |
1932 | 120 | fileMap = 0; | 120 | fileMap = 0; |
1933 | 121 | qDebug() << __FILE__ << __LINE__ << ": mmap'ing history failed. errno = " << errno; | 121 | qDebug() << __FILE__ << __LINE__ << ": mmap'ing history failed. errno = " << errno; |
1934 | 122 | } | 122 | } |
1935 | @@ -139,7 +139,7 @@ | |||
1936 | 139 | { | 139 | { |
1937 | 140 | if ( fileMap ) | 140 | if ( fileMap ) |
1938 | 141 | unmap(); | 141 | unmap(); |
1940 | 142 | 142 | ||
1941 | 143 | readWriteBalance++; | 143 | readWriteBalance++; |
1942 | 144 | 144 | ||
1943 | 145 | int rc = 0; | 145 | int rc = 0; |
1944 | @@ -151,8 +151,8 @@ | |||
1945 | 151 | 151 | ||
1946 | 152 | void HistoryFile::get(unsigned char* bytes, int len, int loc) | 152 | void HistoryFile::get(unsigned char* bytes, int len, int loc) |
1947 | 153 | { | 153 | { |
1950 | 154 | //count number of get() calls vs. number of add() calls. | 154 | //count number of get() calls vs. number of add() calls. |
1951 | 155 | //If there are many more get() calls compared with add() | 155 | //If there are many more get() calls compared with add() |
1952 | 156 | //calls (decided by using MAP_THRESHOLD) then mmap the log | 156 | //calls (decided by using MAP_THRESHOLD) then mmap the log |
1953 | 157 | //file to improve performance. | 157 | //file to improve performance. |
1954 | 158 | readWriteBalance--; | 158 | readWriteBalance--; |
1955 | @@ -165,7 +165,7 @@ | |||
1956 | 165 | bytes[i]=fileMap[loc+i]; | 165 | bytes[i]=fileMap[loc+i]; |
1957 | 166 | } | 166 | } |
1958 | 167 | else | 167 | else |
1960 | 168 | { | 168 | { |
1961 | 169 | int rc = 0; | 169 | int rc = 0; |
1962 | 170 | 170 | ||
1963 | 171 | if (loc < 0 || len < 0 || loc + len > length) | 171 | if (loc < 0 || len < 0 || loc + len > length) |
1964 | @@ -201,7 +201,7 @@ | |||
1965 | 201 | 201 | ||
1966 | 202 | // History Scroll File ////////////////////////////////////// | 202 | // History Scroll File ////////////////////////////////////// |
1967 | 203 | 203 | ||
1969 | 204 | /* | 204 | /* |
1970 | 205 | The history scroll makes a Row(Row(Cell)) from | 205 | The history scroll makes a Row(Row(Cell)) from |
1971 | 206 | two history buffers. The index buffer contains | 206 | two history buffers. The index buffer contains |
1972 | 207 | start of line positions which refere to the cells | 207 | start of line positions which refere to the cells |
1973 | @@ -221,7 +221,7 @@ | |||
1974 | 221 | HistoryScrollFile::~HistoryScrollFile() | 221 | HistoryScrollFile::~HistoryScrollFile() |
1975 | 222 | { | 222 | { |
1976 | 223 | } | 223 | } |
1978 | 224 | 224 | ||
1979 | 225 | int HistoryScrollFile::getLines() | 225 | int HistoryScrollFile::getLines() |
1980 | 226 | { | 226 | { |
1981 | 227 | return index.len() / sizeof(int); | 227 | return index.len() / sizeof(int); |
1982 | @@ -246,11 +246,11 @@ | |||
1983 | 246 | { | 246 | { |
1984 | 247 | if (lineno <= 0) return 0; | 247 | if (lineno <= 0) return 0; |
1985 | 248 | if (lineno <= getLines()) | 248 | if (lineno <= getLines()) |
1988 | 249 | { | 249 | { |
1989 | 250 | 250 | ||
1990 | 251 | if (!index.isMapped()) | 251 | if (!index.isMapped()) |
1991 | 252 | index.map(); | 252 | index.map(); |
1993 | 253 | 253 | ||
1994 | 254 | int res; | 254 | int res; |
1995 | 255 | index.get((unsigned char*)&res,sizeof(int),(lineno-1)*sizeof(int)); | 255 | index.get((unsigned char*)&res,sizeof(int),(lineno-1)*sizeof(int)); |
1996 | 256 | return res; | 256 | return res; |
1997 | @@ -345,7 +345,7 @@ | |||
1998 | 345 | bool HistoryScrollBuffer::isWrappedLine(int lineNumber) | 345 | bool HistoryScrollBuffer::isWrappedLine(int lineNumber) |
1999 | 346 | { | 346 | { |
2000 | 347 | Q_ASSERT( lineNumber >= 0 && lineNumber < _maxLineCount ); | 347 | Q_ASSERT( lineNumber >= 0 && lineNumber < _maxLineCount ); |
2002 | 348 | 348 | ||
2003 | 349 | if (lineNumber < _usedLines) | 349 | if (lineNumber < _usedLines) |
2004 | 350 | { | 350 | { |
2005 | 351 | //kDebug() << "Line" << lineNumber << "wrapped is" << _wrappedLine[bufferIndex(lineNumber)]; | 351 | //kDebug() << "Line" << lineNumber << "wrapped is" << _wrappedLine[bufferIndex(lineNumber)]; |
2006 | @@ -361,12 +361,12 @@ | |||
2007 | 361 | 361 | ||
2008 | 362 | Q_ASSERT( lineNumber < _maxLineCount ); | 362 | Q_ASSERT( lineNumber < _maxLineCount ); |
2009 | 363 | 363 | ||
2011 | 364 | if (lineNumber >= _usedLines) | 364 | if (lineNumber >= _usedLines) |
2012 | 365 | { | 365 | { |
2013 | 366 | memset(buffer, 0, count * sizeof(Character)); | 366 | memset(buffer, 0, count * sizeof(Character)); |
2014 | 367 | return; | 367 | return; |
2015 | 368 | } | 368 | } |
2017 | 369 | 369 | ||
2018 | 370 | const HistoryLine& line = _historyBuffer[bufferIndex(lineNumber)]; | 370 | const HistoryLine& line = _historyBuffer[bufferIndex(lineNumber)]; |
2019 | 371 | 371 | ||
2020 | 372 | //kDebug() << "startCol " << startColumn; | 372 | //kDebug() << "startCol " << startColumn; |
2021 | @@ -374,7 +374,7 @@ | |||
2022 | 374 | //kDebug() << "count " << count; | 374 | //kDebug() << "count " << count; |
2023 | 375 | 375 | ||
2024 | 376 | Q_ASSERT( startColumn <= line.size() - count ); | 376 | Q_ASSERT( startColumn <= line.size() - count ); |
2026 | 377 | 377 | ||
2027 | 378 | memcpy(buffer, line.constData() + startColumn , count * sizeof(Character)); | 378 | memcpy(buffer, line.constData() + startColumn , count * sizeof(Character)); |
2028 | 379 | } | 379 | } |
2029 | 380 | 380 | ||
2030 | @@ -382,12 +382,12 @@ | |||
2031 | 382 | { | 382 | { |
2032 | 383 | HistoryLine* oldBuffer = _historyBuffer; | 383 | HistoryLine* oldBuffer = _historyBuffer; |
2033 | 384 | HistoryLine* newBuffer = new HistoryLine[lineCount]; | 384 | HistoryLine* newBuffer = new HistoryLine[lineCount]; |
2035 | 385 | 385 | ||
2036 | 386 | for ( int i = 0 ; i < qMin(_usedLines,(int)lineCount) ; i++ ) | 386 | for ( int i = 0 ; i < qMin(_usedLines,(int)lineCount) ; i++ ) |
2037 | 387 | { | 387 | { |
2038 | 388 | newBuffer[i] = oldBuffer[bufferIndex(i)]; | 388 | newBuffer[i] = oldBuffer[bufferIndex(i)]; |
2039 | 389 | } | 389 | } |
2041 | 390 | 390 | ||
2042 | 391 | _usedLines = qMin(_usedLines,(int)lineCount); | 391 | _usedLines = qMin(_usedLines,(int)lineCount); |
2043 | 392 | _maxLineCount = lineCount; | 392 | _maxLineCount = lineCount; |
2044 | 393 | _head = ( _usedLines == _maxLineCount ) ? 0 : _usedLines-1; | 393 | _head = ( _usedLines == _maxLineCount ) ? 0 : _usedLines-1; |
2045 | @@ -410,7 +410,7 @@ | |||
2046 | 410 | return (_head+lineNumber+1) % _maxLineCount; | 410 | return (_head+lineNumber+1) % _maxLineCount; |
2047 | 411 | } | 411 | } |
2048 | 412 | else | 412 | else |
2050 | 413 | { | 413 | { |
2051 | 414 | return lineNumber; | 414 | return lineNumber; |
2052 | 415 | } | 415 | } |
2053 | 416 | } | 416 | } |
2054 | @@ -508,7 +508,7 @@ | |||
2055 | 508 | void HistoryScrollBlockArray::addCells(const Character a[], int count) | 508 | void HistoryScrollBlockArray::addCells(const Character a[], int count) |
2056 | 509 | { | 509 | { |
2057 | 510 | Block *b = m_blockArray.lastBlock(); | 510 | Block *b = m_blockArray.lastBlock(); |
2059 | 511 | 511 | ||
2060 | 512 | if (!b) return; | 512 | if (!b) return; |
2061 | 513 | 513 | ||
2062 | 514 | // put cells in block's data | 514 | // put cells in block's data |
2063 | @@ -572,17 +572,17 @@ | |||
2064 | 572 | void CompactHistoryBlockList::deallocate(void* ptr) | 572 | void CompactHistoryBlockList::deallocate(void* ptr) |
2065 | 573 | { | 573 | { |
2066 | 574 | Q_ASSERT( !list.isEmpty()); | 574 | Q_ASSERT( !list.isEmpty()); |
2069 | 575 | 575 | ||
2070 | 576 | int i=0; | 576 | int i=0; |
2071 | 577 | CompactHistoryBlock *block = list.at(i); | 577 | CompactHistoryBlock *block = list.at(i); |
2072 | 578 | while ( i<list.size() && !block->contains(ptr) ) | 578 | while ( i<list.size() && !block->contains(ptr) ) |
2074 | 579 | { | 579 | { |
2075 | 580 | i++; | 580 | i++; |
2076 | 581 | block=list.at(i); | 581 | block=list.at(i); |
2077 | 582 | } | 582 | } |
2078 | 583 | 583 | ||
2079 | 584 | Q_ASSERT( i<list.size() ); | 584 | Q_ASSERT( i<list.size() ); |
2081 | 585 | 585 | ||
2082 | 586 | block->deallocate(); | 586 | block->deallocate(); |
2083 | 587 | 587 | ||
2084 | 588 | if (!block->isInUse()) | 588 | if (!block->isInUse()) |
2085 | @@ -604,16 +604,16 @@ | |||
2086 | 604 | return blockList.allocate(size); | 604 | return blockList.allocate(size); |
2087 | 605 | } | 605 | } |
2088 | 606 | 606 | ||
2090 | 607 | CompactHistoryLine::CompactHistoryLine ( const TextLine& line, CompactHistoryBlockList& bList ) | 607 | CompactHistoryLine::CompactHistoryLine ( const TextLine& line, CompactHistoryBlockList& bList ) |
2091 | 608 | : blockList(bList), | 608 | : blockList(bList), |
2092 | 609 | formatLength(0) | 609 | formatLength(0) |
2093 | 610 | { | 610 | { |
2094 | 611 | length=line.size(); | 611 | length=line.size(); |
2096 | 612 | 612 | ||
2097 | 613 | if (line.size() > 0) { | 613 | if (line.size() > 0) { |
2098 | 614 | formatLength=1; | 614 | formatLength=1; |
2099 | 615 | int k=1; | 615 | int k=1; |
2101 | 616 | 616 | ||
2102 | 617 | // count number of different formats in this text line | 617 | // count number of different formats in this text line |
2103 | 618 | Character c = line[0]; | 618 | Character c = line[0]; |
2104 | 619 | while ( k<length ) | 619 | while ( k<length ) |
2105 | @@ -625,22 +625,22 @@ | |||
2106 | 625 | } | 625 | } |
2107 | 626 | k++; | 626 | k++; |
2108 | 627 | } | 627 | } |
2110 | 628 | 628 | ||
2111 | 629 | //kDebug() << "number of different formats in string: " << formatLength; | 629 | //kDebug() << "number of different formats in string: " << formatLength; |
2112 | 630 | formatArray = (CharacterFormat*) blockList.allocate(sizeof(CharacterFormat)*formatLength); | 630 | formatArray = (CharacterFormat*) blockList.allocate(sizeof(CharacterFormat)*formatLength); |
2113 | 631 | Q_ASSERT (formatArray!=NULL); | 631 | Q_ASSERT (formatArray!=NULL); |
2114 | 632 | text = (quint16*) blockList.allocate(sizeof(quint16)*line.size()); | 632 | text = (quint16*) blockList.allocate(sizeof(quint16)*line.size()); |
2115 | 633 | Q_ASSERT (text!=NULL); | 633 | Q_ASSERT (text!=NULL); |
2117 | 634 | 634 | ||
2118 | 635 | length=line.size(); | 635 | length=line.size(); |
2119 | 636 | formatLength=formatLength; | 636 | formatLength=formatLength; |
2120 | 637 | wrapped=false; | 637 | wrapped=false; |
2122 | 638 | 638 | ||
2123 | 639 | // record formats and their positions in the format array | 639 | // record formats and their positions in the format array |
2124 | 640 | c=line[0]; | 640 | c=line[0]; |
2125 | 641 | formatArray[0].setFormat ( c ); | 641 | formatArray[0].setFormat ( c ); |
2126 | 642 | formatArray[0].startPos=0; // there's always at least 1 format (for the entire line, unless a change happens) | 642 | formatArray[0].startPos=0; // there's always at least 1 format (for the entire line, unless a change happens) |
2128 | 643 | 643 | ||
2129 | 644 | k=1; // look for possible format changes | 644 | k=1; // look for possible format changes |
2130 | 645 | int j=1; | 645 | int j=1; |
2131 | 646 | while ( k<length && j<formatLength ) | 646 | while ( k<length && j<formatLength ) |
2132 | @@ -655,7 +655,7 @@ | |||
2133 | 655 | } | 655 | } |
2134 | 656 | k++; | 656 | k++; |
2135 | 657 | } | 657 | } |
2137 | 658 | 658 | ||
2138 | 659 | // copy character values | 659 | // copy character values |
2139 | 660 | for ( int i=0; i<line.size(); i++ ) | 660 | for ( int i=0; i<line.size(); i++ ) |
2140 | 661 | { | 661 | { |
2141 | @@ -673,7 +673,7 @@ | |||
2142 | 673 | blockList.deallocate(text); | 673 | blockList.deallocate(text); |
2143 | 674 | blockList.deallocate(formatArray); | 674 | blockList.deallocate(formatArray); |
2144 | 675 | } | 675 | } |
2146 | 676 | blockList.deallocate(this); | 676 | blockList.deallocate(this); |
2147 | 677 | } | 677 | } |
2148 | 678 | 678 | ||
2149 | 679 | void CompactHistoryLine::getCharacter ( int index, Character &r ) | 679 | void CompactHistoryLine::getCharacter ( int index, Character &r ) |
2150 | @@ -918,7 +918,7 @@ | |||
2151 | 918 | 918 | ||
2152 | 919 | HistoryScroll* HistoryTypeFile::scroll(HistoryScroll *old) const | 919 | HistoryScroll* HistoryTypeFile::scroll(HistoryScroll *old) const |
2153 | 920 | { | 920 | { |
2155 | 921 | if (dynamic_cast<HistoryFile *>(old)) | 921 | if (dynamic_cast<HistoryFile *>(old)) |
2156 | 922 | return old; // Unchanged. | 922 | return old; // Unchanged. |
2157 | 923 | 923 | ||
2158 | 924 | HistoryScroll *newScroll = new HistoryScrollFile(m_fileName); | 924 | HistoryScroll *newScroll = new HistoryScrollFile(m_fileName); |
2159 | @@ -945,7 +945,7 @@ | |||
2160 | 945 | } | 945 | } |
2161 | 946 | 946 | ||
2162 | 947 | delete old; | 947 | delete old; |
2164 | 948 | return newScroll; | 948 | return newScroll; |
2165 | 949 | } | 949 | } |
2166 | 950 | 950 | ||
2167 | 951 | int HistoryTypeFile::maximumLineCount() const | 951 | int HistoryTypeFile::maximumLineCount() const |
2168 | 952 | 952 | ||
2169 | === modified file 'src/plugin/konsole/History.h' | |||
2170 | --- src/plugin/konsole/History.h 2014-04-27 09:11:14 +0000 | |||
2171 | +++ src/plugin/konsole/History.h 2014-07-30 09:50:10 +0000 | |||
2172 | @@ -68,7 +68,7 @@ | |||
2173 | 68 | 68 | ||
2174 | 69 | //pointer to start of mmap'ed file data, or 0 if the file is not mmap'ed | 69 | //pointer to start of mmap'ed file data, or 0 if the file is not mmap'ed |
2175 | 70 | char* fileMap; | 70 | char* fileMap; |
2177 | 71 | 71 | ||
2178 | 72 | //incremented whenver 'add' is called and decremented whenever | 72 | //incremented whenver 'add' is called and decremented whenever |
2179 | 73 | //'get' is called. | 73 | //'get' is called. |
2180 | 74 | //this is used to detect when a large number of lines are being read and processed from the history | 74 | //this is used to detect when a large number of lines are being read and processed from the history |
2181 | @@ -179,7 +179,7 @@ | |||
2182 | 179 | 179 | ||
2183 | 180 | void setMaxNbLines(unsigned int nbLines); | 180 | void setMaxNbLines(unsigned int nbLines); |
2184 | 181 | unsigned int maxNbLines() { return _maxLineCount; } | 181 | unsigned int maxNbLines() { return _maxLineCount; } |
2186 | 182 | 182 | ||
2187 | 183 | 183 | ||
2188 | 184 | private: | 184 | private: |
2189 | 185 | int bufferIndex(int lineNumber); | 185 | int bufferIndex(int lineNumber); |
2190 | @@ -187,9 +187,9 @@ | |||
2191 | 187 | HistoryLine* _historyBuffer; | 187 | HistoryLine* _historyBuffer; |
2192 | 188 | QBitArray _wrappedLine; | 188 | QBitArray _wrappedLine; |
2193 | 189 | int _maxLineCount; | 189 | int _maxLineCount; |
2195 | 190 | int _usedLines; | 190 | int _usedLines; |
2196 | 191 | int _head; | 191 | int _head; |
2198 | 192 | 192 | ||
2199 | 193 | //QVector<histline*> m_histBuffer; | 193 | //QVector<histline*> m_histBuffer; |
2200 | 194 | //QBitArray m_wrappedLine; | 194 | //QBitArray m_wrappedLine; |
2201 | 195 | //unsigned int m_maxNbLines; | 195 | //unsigned int m_maxNbLines; |
2202 | @@ -288,7 +288,7 @@ | |||
2203 | 288 | class CompactHistoryBlock | 288 | class CompactHistoryBlock |
2204 | 289 | { | 289 | { |
2205 | 290 | public: | 290 | public: |
2207 | 291 | 291 | ||
2208 | 292 | CompactHistoryBlock(){ | 292 | CompactHistoryBlock(){ |
2209 | 293 | blockLength = 4096*64; // 256kb | 293 | blockLength = 4096*64; // 256kb |
2210 | 294 | head = (quint8*) mmap(0, blockLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); | 294 | head = (quint8*) mmap(0, blockLength, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); |
2211 | @@ -297,12 +297,12 @@ | |||
2212 | 297 | tail = blockStart = head; | 297 | tail = blockStart = head; |
2213 | 298 | allocCount=0; | 298 | allocCount=0; |
2214 | 299 | } | 299 | } |
2216 | 300 | 300 | ||
2217 | 301 | virtual ~CompactHistoryBlock(){ | 301 | virtual ~CompactHistoryBlock(){ |
2218 | 302 | //free(blockStart); | 302 | //free(blockStart); |
2219 | 303 | munmap(blockStart, blockLength); | 303 | munmap(blockStart, blockLength); |
2220 | 304 | } | 304 | } |
2222 | 305 | 305 | ||
2223 | 306 | virtual unsigned int remaining(){ return blockStart+blockLength-tail;} | 306 | virtual unsigned int remaining(){ return blockStart+blockLength-tail;} |
2224 | 307 | virtual unsigned length() { return blockLength; } | 307 | virtual unsigned length() { return blockLength; } |
2225 | 308 | virtual void* allocate(size_t length); | 308 | virtual void* allocate(size_t length); |
2226 | @@ -379,7 +379,7 @@ | |||
2227 | 379 | bool hasDifferentColors(const TextLine& line) const; | 379 | bool hasDifferentColors(const TextLine& line) const; |
2228 | 380 | HistoryArray lines; | 380 | HistoryArray lines; |
2229 | 381 | CompactHistoryBlockList blockList; | 381 | CompactHistoryBlockList blockList; |
2231 | 382 | 382 | ||
2232 | 383 | unsigned int _maxLineCount; | 383 | unsigned int _maxLineCount; |
2233 | 384 | }; | 384 | }; |
2234 | 385 | 385 | ||
2235 | @@ -395,7 +395,7 @@ | |||
2236 | 395 | 395 | ||
2237 | 396 | /** | 396 | /** |
2238 | 397 | * Returns true if the history is enabled ( can store lines of output ) | 397 | * Returns true if the history is enabled ( can store lines of output ) |
2240 | 398 | * or false otherwise. | 398 | * or false otherwise. |
2241 | 399 | */ | 399 | */ |
2242 | 400 | virtual bool isEnabled() const = 0; | 400 | virtual bool isEnabled() const = 0; |
2243 | 401 | /** | 401 | /** |
2244 | @@ -426,7 +426,7 @@ | |||
2245 | 426 | { | 426 | { |
2246 | 427 | public: | 427 | public: |
2247 | 428 | HistoryTypeBlockArray(size_t size); | 428 | HistoryTypeBlockArray(size_t size); |
2249 | 429 | 429 | ||
2250 | 430 | virtual bool isEnabled() const; | 430 | virtual bool isEnabled() const; |
2251 | 431 | virtual int maximumLineCount() const; | 431 | virtual int maximumLineCount() const; |
2252 | 432 | 432 | ||
2253 | @@ -436,7 +436,7 @@ | |||
2254 | 436 | size_t m_size; | 436 | size_t m_size; |
2255 | 437 | }; | 437 | }; |
2256 | 438 | 438 | ||
2258 | 439 | #if 1 | 439 | #if 1 |
2259 | 440 | class HistoryTypeFile : public HistoryType | 440 | class HistoryTypeFile : public HistoryType |
2260 | 441 | { | 441 | { |
2261 | 442 | public: | 442 | public: |
2262 | @@ -459,10 +459,10 @@ | |||
2263 | 459 | 459 | ||
2264 | 460 | public: | 460 | public: |
2265 | 461 | HistoryTypeBuffer(unsigned int nbLines); | 461 | HistoryTypeBuffer(unsigned int nbLines); |
2267 | 462 | 462 | ||
2268 | 463 | virtual bool isEnabled() const; | 463 | virtual bool isEnabled() const; |
2269 | 464 | virtual int maximumLineCount() const; | 464 | virtual int maximumLineCount() const; |
2271 | 465 | 465 | ||
2272 | 466 | virtual HistoryScroll* scroll(HistoryScroll *) const; | 466 | virtual HistoryScroll* scroll(HistoryScroll *) const; |
2273 | 467 | 467 | ||
2274 | 468 | protected: | 468 | protected: |
2275 | @@ -473,7 +473,7 @@ | |||
2276 | 473 | { | 473 | { |
2277 | 474 | public: | 474 | public: |
2278 | 475 | CompactHistoryType(unsigned int size); | 475 | CompactHistoryType(unsigned int size); |
2280 | 476 | 476 | ||
2281 | 477 | virtual bool isEnabled() const; | 477 | virtual bool isEnabled() const; |
2282 | 478 | virtual int maximumLineCount() const; | 478 | virtual int maximumLineCount() const; |
2283 | 479 | 479 | ||
2284 | 480 | 480 | ||
2285 | === modified file 'src/plugin/konsole/KeyboardTranslator.cpp' | |||
2286 | --- src/plugin/konsole/KeyboardTranslator.cpp 2014-04-27 09:11:14 +0000 | |||
2287 | +++ src/plugin/konsole/KeyboardTranslator.cpp 2014-07-30 09:50:10 +0000 | |||
2288 | @@ -83,8 +83,8 @@ | |||
2289 | 83 | QString translatorPath = listIter.next(); | 83 | QString translatorPath = listIter.next(); |
2290 | 84 | 84 | ||
2291 | 85 | QString name = QFileInfo(translatorPath).baseName(); | 85 | QString name = QFileInfo(translatorPath).baseName(); |
2294 | 86 | 86 | ||
2295 | 87 | if ( !_translators.contains(name) ) | 87 | if ( !_translators.contains(name) ) |
2296 | 88 | _translators.insert(name,0); | 88 | _translators.insert(name,0); |
2297 | 89 | } | 89 | } |
2298 | 90 | 90 | ||
2299 | @@ -122,7 +122,7 @@ | |||
2300 | 122 | QFile destination(path); | 122 | QFile destination(path); |
2301 | 123 | if (!destination.open(QIODevice::WriteOnly | QIODevice::Text)) | 123 | if (!destination.open(QIODevice::WriteOnly | QIODevice::Text)) |
2302 | 124 | { | 124 | { |
2304 | 125 | qDebug() << "Unable to save keyboard translation:" | 125 | qDebug() << "Unable to save keyboard translation:" |
2305 | 126 | << destination.errorString(); | 126 | << destination.errorString(); |
2306 | 127 | return false; | 127 | return false; |
2307 | 128 | } | 128 | } |
2308 | @@ -130,7 +130,7 @@ | |||
2309 | 130 | { | 130 | { |
2310 | 131 | KeyboardTranslatorWriter writer(&destination); | 131 | KeyboardTranslatorWriter writer(&destination); |
2311 | 132 | writer.writeHeader(translator->description()); | 132 | writer.writeHeader(translator->description()); |
2313 | 133 | 133 | ||
2314 | 134 | QListIterator<KeyboardTranslator::Entry> iter(translator->entries()); | 134 | QListIterator<KeyboardTranslator::Entry> iter(translator->entries()); |
2315 | 135 | while ( iter.hasNext() ) | 135 | while ( iter.hasNext() ) |
2316 | 136 | writer.writeEntry(iter.next()); | 136 | writer.writeEntry(iter.next()); |
2317 | @@ -145,7 +145,7 @@ | |||
2318 | 145 | { | 145 | { |
2319 | 146 | const QString& path = findTranslatorPath(name); | 146 | const QString& path = findTranslatorPath(name); |
2320 | 147 | 147 | ||
2322 | 148 | QFile source(path); | 148 | QFile source(path); |
2323 | 149 | if (name.isEmpty() || !source.open(QIODevice::ReadOnly | QIODevice::Text)) | 149 | if (name.isEmpty() || !source.open(QIODevice::ReadOnly | QIODevice::Text)) |
2324 | 150 | return 0; | 150 | return 0; |
2325 | 151 | 151 | ||
2326 | @@ -224,7 +224,7 @@ | |||
2327 | 224 | // KeySequence begins with the name of the key ( taken from the Qt::Key enum ) | 224 | // KeySequence begins with the name of the key ( taken from the Qt::Key enum ) |
2328 | 225 | // and is followed by the keyboard modifiers and state flags ( with + or - in front | 225 | // and is followed by the keyboard modifiers and state flags ( with + or - in front |
2329 | 226 | // of each modifier or flag to indicate whether it is required ). All keyboard modifiers | 226 | // of each modifier or flag to indicate whether it is required ). All keyboard modifiers |
2331 | 227 | // and flags are optional, if a particular modifier or state is not specified it is | 227 | // and flags are optional, if a particular modifier or state is not specified it is |
2332 | 228 | // assumed not to be a part of the sequence. The key sequence may contain whitespace | 228 | // assumed not to be a part of the sequence. The key sequence may contain whitespace |
2333 | 229 | // | 229 | // |
2334 | 230 | // eg: "key Up+Shift : scrollLineUp" | 230 | // eg: "key Up+Shift : scrollLineUp" |
2335 | @@ -248,7 +248,7 @@ | |||
2336 | 248 | // read first entry (if any) | 248 | // read first entry (if any) |
2337 | 249 | readNext(); | 249 | readNext(); |
2338 | 250 | } | 250 | } |
2340 | 251 | void KeyboardTranslatorReader::readNext() | 251 | void KeyboardTranslatorReader::readNext() |
2341 | 252 | { | 252 | { |
2342 | 253 | // find next entry | 253 | // find next entry |
2343 | 254 | while ( !_source->atEnd() ) | 254 | while ( !_source->atEnd() ) |
2344 | @@ -268,7 +268,7 @@ | |||
2345 | 268 | modifiers, | 268 | modifiers, |
2346 | 269 | modifierMask, | 269 | modifierMask, |
2347 | 270 | flags, | 270 | flags, |
2349 | 271 | flagMask); | 271 | flagMask); |
2350 | 272 | 272 | ||
2351 | 273 | KeyboardTranslator::Command command = KeyboardTranslator::NoCommand; | 273 | KeyboardTranslator::Command command = KeyboardTranslator::NoCommand; |
2352 | 274 | QByteArray text; | 274 | QByteArray text; |
2353 | @@ -300,12 +300,12 @@ | |||
2354 | 300 | 300 | ||
2355 | 301 | return; | 301 | return; |
2356 | 302 | } | 302 | } |
2358 | 303 | } | 303 | } |
2359 | 304 | 304 | ||
2360 | 305 | _hasNext = false; | 305 | _hasNext = false; |
2361 | 306 | } | 306 | } |
2362 | 307 | 307 | ||
2364 | 308 | bool KeyboardTranslatorReader::parseAsCommand(const QString& text,KeyboardTranslator::Command& command) | 308 | bool KeyboardTranslatorReader::parseAsCommand(const QString& text,KeyboardTranslator::Command& command) |
2365 | 309 | { | 309 | { |
2366 | 310 | if ( text.compare("erase",Qt::CaseInsensitive) == 0 ) | 310 | if ( text.compare("erase",Qt::CaseInsensitive) == 0 ) |
2367 | 311 | command = KeyboardTranslator::EraseCommand; | 311 | command = KeyboardTranslator::EraseCommand; |
2368 | @@ -332,7 +332,7 @@ | |||
2369 | 332 | KeyboardTranslator::States& flags, | 332 | KeyboardTranslator::States& flags, |
2370 | 333 | KeyboardTranslator::States& flagMask) | 333 | KeyboardTranslator::States& flagMask) |
2371 | 334 | { | 334 | { |
2373 | 335 | bool isWanted = true; | 335 | bool isWanted = true; |
2374 | 336 | bool endOfItem = false; | 336 | bool endOfItem = false; |
2375 | 337 | QString buffer; | 337 | QString buffer; |
2376 | 338 | 338 | ||
2377 | @@ -384,13 +384,13 @@ | |||
2378 | 384 | buffer.clear(); | 384 | buffer.clear(); |
2379 | 385 | } | 385 | } |
2380 | 386 | 386 | ||
2382 | 387 | // check if this is a wanted / not-wanted flag and update the | 387 | // check if this is a wanted / not-wanted flag and update the |
2383 | 388 | // state ready for the next item | 388 | // state ready for the next item |
2384 | 389 | if ( ch == '+' ) | 389 | if ( ch == '+' ) |
2385 | 390 | isWanted = true; | 390 | isWanted = true; |
2386 | 391 | else if ( ch == '-' ) | 391 | else if ( ch == '-' ) |
2389 | 392 | isWanted = false; | 392 | isWanted = false; |
2390 | 393 | } | 393 | } |
2391 | 394 | 394 | ||
2392 | 395 | modifiers = tempModifiers; | 395 | modifiers = tempModifiers; |
2393 | 396 | modifierMask = tempModifierMask; | 396 | modifierMask = tempModifierMask; |
2394 | @@ -467,7 +467,7 @@ | |||
2395 | 467 | { | 467 | { |
2396 | 468 | return _hasNext; | 468 | return _hasNext; |
2397 | 469 | } | 469 | } |
2399 | 470 | KeyboardTranslator::Entry KeyboardTranslatorReader::createEntry( const QString& condition , | 470 | KeyboardTranslator::Entry KeyboardTranslatorReader::createEntry( const QString& condition , |
2400 | 471 | const QString& result ) | 471 | const QString& result ) |
2401 | 472 | { | 472 | { |
2402 | 473 | QString entryString("keyboard \"temporary\"\nkey "); | 473 | QString entryString("keyboard \"temporary\"\nkey "); |
2403 | @@ -495,7 +495,7 @@ | |||
2404 | 495 | return entry; | 495 | return entry; |
2405 | 496 | } | 496 | } |
2406 | 497 | 497 | ||
2408 | 498 | KeyboardTranslator::Entry KeyboardTranslatorReader::nextEntry() | 498 | KeyboardTranslator::Entry KeyboardTranslatorReader::nextEntry() |
2409 | 499 | { | 499 | { |
2410 | 500 | Q_ASSERT( _hasNext ); | 500 | Q_ASSERT( _hasNext ); |
2411 | 501 | KeyboardTranslator::Entry entry = _nextEntry; | 501 | KeyboardTranslator::Entry entry = _nextEntry; |
2412 | @@ -510,7 +510,7 @@ | |||
2413 | 510 | { | 510 | { |
2414 | 511 | QString text = line; | 511 | QString text = line; |
2415 | 512 | 512 | ||
2417 | 513 | // remove comments | 513 | // remove comments |
2418 | 514 | bool inQuotes = false; | 514 | bool inQuotes = false; |
2419 | 515 | int commentPos = -1; | 515 | int commentPos = -1; |
2420 | 516 | for (int i=text.length()-1;i>=0;i--) | 516 | for (int i=text.length()-1;i>=0;i--) |
2421 | @@ -525,7 +525,7 @@ | |||
2422 | 525 | text.remove(commentPos,text.length()); | 525 | text.remove(commentPos,text.length()); |
2423 | 526 | 526 | ||
2424 | 527 | text = text.simplified(); | 527 | text = text.simplified(); |
2426 | 528 | 528 | ||
2427 | 529 | // title line: keyboard "title" | 529 | // title line: keyboard "title" |
2428 | 530 | static QRegExp title("keyboard\\s+\"(.*)\""); | 530 | static QRegExp title("keyboard\\s+\"(.*)\""); |
2429 | 531 | // key line: key KeySequence : "output" | 531 | // key line: key KeySequence : "output" |
2430 | @@ -533,7 +533,7 @@ | |||
2431 | 533 | static QRegExp key("key\\s+([\\w\\+\\s\\-\\*\\.]+)\\s*:\\s*(\"(.*)\"|\\w+)"); | 533 | static QRegExp key("key\\s+([\\w\\+\\s\\-\\*\\.]+)\\s*:\\s*(\"(.*)\"|\\w+)"); |
2432 | 534 | 534 | ||
2433 | 535 | QList<Token> list; | 535 | QList<Token> list; |
2435 | 536 | if ( text.isEmpty() ) | 536 | if ( text.isEmpty() ) |
2436 | 537 | { | 537 | { |
2437 | 538 | return list; | 538 | return list; |
2438 | 539 | } | 539 | } |
2439 | @@ -542,7 +542,7 @@ | |||
2440 | 542 | { | 542 | { |
2441 | 543 | Token titleToken = { Token::TitleKeyword , QString() }; | 543 | Token titleToken = { Token::TitleKeyword , QString() }; |
2442 | 544 | Token textToken = { Token::TitleText , title.capturedTexts()[1] }; | 544 | Token textToken = { Token::TitleText , title.capturedTexts()[1] }; |
2444 | 545 | 545 | ||
2445 | 546 | list << titleToken << textToken; | 546 | list << titleToken << textToken; |
2446 | 547 | } | 547 | } |
2447 | 548 | else if ( key.exactMatch(text) ) | 548 | else if ( key.exactMatch(text) ) |
2448 | @@ -556,14 +556,14 @@ | |||
2449 | 556 | { | 556 | { |
2450 | 557 | // capturedTexts()[2] is a command | 557 | // capturedTexts()[2] is a command |
2451 | 558 | Token commandToken = { Token::Command , key.capturedTexts()[2] }; | 558 | Token commandToken = { Token::Command , key.capturedTexts()[2] }; |
2454 | 559 | list << commandToken; | 559 | list << commandToken; |
2455 | 560 | } | 560 | } |
2456 | 561 | else | 561 | else |
2457 | 562 | { | 562 | { |
2458 | 563 | // capturedTexts()[3] is the output string | 563 | // capturedTexts()[3] is the output string |
2459 | 564 | Token outputToken = { Token::OutputText , key.capturedTexts()[3] }; | 564 | Token outputToken = { Token::OutputText , key.capturedTexts()[3] }; |
2460 | 565 | list << outputToken; | 565 | list << outputToken; |
2462 | 566 | } | 566 | } |
2463 | 567 | } | 567 | } |
2464 | 568 | else | 568 | else |
2465 | 569 | { | 569 | { |
2466 | @@ -573,7 +573,7 @@ | |||
2467 | 573 | return list; | 573 | return list; |
2468 | 574 | } | 574 | } |
2469 | 575 | 575 | ||
2471 | 576 | QList<QString> KeyboardTranslatorManager::allTranslators() | 576 | QList<QString> KeyboardTranslatorManager::allTranslators() |
2472 | 577 | { | 577 | { |
2473 | 578 | if ( !_haveLoadedAll ) | 578 | if ( !_haveLoadedAll ) |
2474 | 579 | { | 579 | { |
2475 | @@ -604,14 +604,14 @@ | |||
2476 | 604 | _text == rhs._text; | 604 | _text == rhs._text; |
2477 | 605 | } | 605 | } |
2478 | 606 | 606 | ||
2480 | 607 | bool KeyboardTranslator::Entry::matches(int keyCode , | 607 | bool KeyboardTranslator::Entry::matches(int keyCode , |
2481 | 608 | Qt::KeyboardModifiers modifiers, | 608 | Qt::KeyboardModifiers modifiers, |
2482 | 609 | States testState) const | 609 | States testState) const |
2483 | 610 | { | 610 | { |
2484 | 611 | if ( _keyCode != keyCode ) | 611 | if ( _keyCode != keyCode ) |
2485 | 612 | return false; | 612 | return false; |
2486 | 613 | 613 | ||
2488 | 614 | if ( (modifiers & _modifierMask) != (_modifiers & _modifierMask) ) | 614 | if ( (modifiers & _modifierMask) != (_modifiers & _modifierMask) ) |
2489 | 615 | return false; | 615 | return false; |
2490 | 616 | 616 | ||
2491 | 617 | // if modifiers is non-zero, the 'any modifier' state is implicit | 617 | // if modifiers is non-zero, the 'any modifier' state is implicit |
2492 | @@ -621,7 +621,7 @@ | |||
2493 | 621 | if ( (testState & _stateMask) != (_state & _stateMask) ) | 621 | if ( (testState & _stateMask) != (_state & _stateMask) ) |
2494 | 622 | return false; | 622 | return false; |
2495 | 623 | 623 | ||
2497 | 624 | // special handling for the 'Any Modifier' state, which checks for the presence of | 624 | // special handling for the 'Any Modifier' state, which checks for the presence of |
2498 | 625 | // any or no modifiers. In this context, the 'keypad' modifier does not count. | 625 | // any or no modifiers. In this context, the 'keypad' modifier does not count. |
2499 | 626 | bool anyModifiersSet = modifiers != 0 && modifiers != Qt::KeypadModifier; | 626 | bool anyModifiersSet = modifiers != 0 && modifiers != Qt::KeypadModifier; |
2500 | 627 | bool wantAnyModifier = _state & KeyboardTranslator::AnyModifierState; | 627 | bool wantAnyModifier = _state & KeyboardTranslator::AnyModifierState; |
2501 | @@ -630,7 +630,7 @@ | |||
2502 | 630 | if ( wantAnyModifier != anyModifiersSet ) | 630 | if ( wantAnyModifier != anyModifiersSet ) |
2503 | 631 | return false; | 631 | return false; |
2504 | 632 | } | 632 | } |
2506 | 633 | 633 | ||
2507 | 634 | return true; | 634 | return true; |
2508 | 635 | } | 635 | } |
2509 | 636 | QByteArray KeyboardTranslator::Entry::escapedText(bool expandWildCards,Qt::KeyboardModifiers modifiers) const | 636 | QByteArray KeyboardTranslator::Entry::escapedText(bool expandWildCards,Qt::KeyboardModifiers modifiers) const |
2510 | @@ -659,7 +659,7 @@ | |||
2511 | 659 | 659 | ||
2512 | 660 | if ( replacement == 'x' ) | 660 | if ( replacement == 'x' ) |
2513 | 661 | { | 661 | { |
2515 | 662 | result.replace(i,1,"\\x"+QByteArray(1,ch).toHex()); | 662 | result.replace(i,1,"\\x"+QByteArray(1,ch).toHex()); |
2516 | 663 | } else if ( replacement != 0 ) | 663 | } else if ( replacement != 0 ) |
2517 | 664 | { | 664 | { |
2518 | 665 | result.remove(i,1); | 665 | result.remove(i,1); |
2519 | @@ -707,7 +707,7 @@ | |||
2520 | 707 | unsigned charValue = 0; | 707 | unsigned charValue = 0; |
2521 | 708 | sscanf(hexDigits,"%x",&charValue); | 708 | sscanf(hexDigits,"%x",&charValue); |
2522 | 709 | 709 | ||
2524 | 710 | replacement[0] = (char)charValue; | 710 | replacement[0] = (char)charValue; |
2525 | 711 | charsToRemove = 2 + strlen(hexDigits); | 711 | charsToRemove = 2 + strlen(hexDigits); |
2526 | 712 | } | 712 | } |
2527 | 713 | break; | 713 | break; |
2528 | @@ -811,7 +811,7 @@ | |||
2529 | 811 | { | 811 | { |
2530 | 812 | } | 812 | } |
2531 | 813 | 813 | ||
2533 | 814 | void KeyboardTranslator::setDescription(const QString& description) | 814 | void KeyboardTranslator::setDescription(const QString& description) |
2534 | 815 | { | 815 | { |
2535 | 816 | _description = description; | 816 | _description = description; |
2536 | 817 | } | 817 | } |
2537 | @@ -874,7 +874,7 @@ | |||
2538 | 874 | if ( QFile::remove(path) ) | 874 | if ( QFile::remove(path) ) |
2539 | 875 | { | 875 | { |
2540 | 876 | _translators.remove(name); | 876 | _translators.remove(name); |
2542 | 877 | return true; | 877 | return true; |
2543 | 878 | } | 878 | } |
2544 | 879 | else | 879 | else |
2545 | 880 | { | 880 | { |
2546 | 881 | 881 | ||
2547 | === modified file 'src/plugin/konsole/KeyboardTranslator.h' | |||
2548 | --- src/plugin/konsole/KeyboardTranslator.h 2014-04-27 09:11:14 +0000 | |||
2549 | +++ src/plugin/konsole/KeyboardTranslator.h 2014-07-30 09:50:10 +0000 | |||
2550 | @@ -37,7 +37,7 @@ | |||
2551 | 37 | class QTextStream; | 37 | class QTextStream; |
2552 | 38 | 38 | ||
2553 | 39 | 39 | ||
2555 | 40 | /** | 40 | /** |
2556 | 41 | * A convertor which maps between key sequences pressed by the user and the | 41 | * A convertor which maps between key sequences pressed by the user and the |
2557 | 42 | * character strings which should be sent to the terminal and commands | 42 | * character strings which should be sent to the terminal and commands |
2558 | 43 | * which should be invoked when those character sequences are pressed. | 43 | * which should be invoked when those character sequences are pressed. |
2559 | @@ -53,7 +53,7 @@ | |||
2560 | 53 | class KeyboardTranslator | 53 | class KeyboardTranslator |
2561 | 54 | { | 54 | { |
2562 | 55 | public: | 55 | public: |
2564 | 56 | /** | 56 | /** |
2565 | 57 | * The meaning of a particular key sequence may depend upon the state which | 57 | * The meaning of a particular key sequence may depend upon the state which |
2566 | 58 | * the terminal emulation is in. Therefore findEntry() may return a different | 58 | * the terminal emulation is in. Therefore findEntry() may return a different |
2567 | 59 | * Entry depending upon the state flags supplied. | 59 | * Entry depending upon the state flags supplied. |
2568 | @@ -69,7 +69,7 @@ | |||
2569 | 69 | * TODO More documentation | 69 | * TODO More documentation |
2570 | 70 | */ | 70 | */ |
2571 | 71 | NewLineState = 1, | 71 | NewLineState = 1, |
2573 | 72 | /** | 72 | /** |
2574 | 73 | * Indicates that the terminal is in 'Ansi' mode. | 73 | * Indicates that the terminal is in 'Ansi' mode. |
2575 | 74 | * TODO: More documentation | 74 | * TODO: More documentation |
2576 | 75 | */ | 75 | */ |
2577 | @@ -80,10 +80,10 @@ | |||
2578 | 80 | CursorKeysState = 4, | 80 | CursorKeysState = 4, |
2579 | 81 | /** | 81 | /** |
2580 | 82 | * Indicates that the alternate screen ( typically used by interactive programs | 82 | * Indicates that the alternate screen ( typically used by interactive programs |
2582 | 83 | * such as screen or vim ) is active | 83 | * such as screen or vim ) is active |
2583 | 84 | */ | 84 | */ |
2584 | 85 | AlternateScreenState = 8, | 85 | AlternateScreenState = 8, |
2586 | 86 | /** Indicates that any of the modifier keys is active. */ | 86 | /** Indicates that any of the modifier keys is active. */ |
2587 | 87 | AnyModifierState = 16, | 87 | AnyModifierState = 16, |
2588 | 88 | /** Indicates that the numpad is in application mode. */ | 88 | /** Indicates that the numpad is in application mode. */ |
2589 | 89 | ApplicationKeypadState = 32 | 89 | ApplicationKeypadState = 32 |
2590 | @@ -122,14 +122,14 @@ | |||
2591 | 122 | class Entry | 122 | class Entry |
2592 | 123 | { | 123 | { |
2593 | 124 | public: | 124 | public: |
2595 | 125 | /** | 125 | /** |
2596 | 126 | * Constructs a new entry for a keyboard translator. | 126 | * Constructs a new entry for a keyboard translator. |
2597 | 127 | */ | 127 | */ |
2598 | 128 | Entry(); | 128 | Entry(); |
2599 | 129 | 129 | ||
2601 | 130 | /** | 130 | /** |
2602 | 131 | * Returns true if this entry is null. | 131 | * Returns true if this entry is null. |
2604 | 132 | * This is true for newly constructed entries which have no properties set. | 132 | * This is true for newly constructed entries which have no properties set. |
2605 | 133 | */ | 133 | */ |
2606 | 134 | bool isNull() const; | 134 | bool isNull() const; |
2607 | 135 | 135 | ||
2608 | @@ -138,15 +138,15 @@ | |||
2609 | 138 | /** Sets the command associated with this entry. */ | 138 | /** Sets the command associated with this entry. */ |
2610 | 139 | void setCommand(Command command); | 139 | void setCommand(Command command); |
2611 | 140 | 140 | ||
2614 | 141 | /** | 141 | /** |
2615 | 142 | * Returns the character sequence associated with this entry, optionally replacing | 142 | * Returns the character sequence associated with this entry, optionally replacing |
2616 | 143 | * wildcard '*' characters with numbers to indicate the keyboard modifiers being pressed. | 143 | * wildcard '*' characters with numbers to indicate the keyboard modifiers being pressed. |
2617 | 144 | * | 144 | * |
2618 | 145 | * TODO: The numbers used to replace '*' characters are taken from the Konsole/KDE 3 code. | 145 | * TODO: The numbers used to replace '*' characters are taken from the Konsole/KDE 3 code. |
2620 | 146 | * Document them. | 146 | * Document them. |
2621 | 147 | * | 147 | * |
2622 | 148 | * @param expandWildCards Specifies whether wild cards (occurrences of the '*' character) in | 148 | * @param expandWildCards Specifies whether wild cards (occurrences of the '*' character) in |
2624 | 149 | * the entry should be replaced with a number to indicate the modifier keys being pressed. | 149 | * the entry should be replaced with a number to indicate the modifier keys being pressed. |
2625 | 150 | * | 150 | * |
2626 | 151 | * @param modifiers The keyboard modifiers being pressed. | 151 | * @param modifiers The keyboard modifiers being pressed. |
2627 | 152 | */ | 152 | */ |
2628 | @@ -156,7 +156,7 @@ | |||
2629 | 156 | /** Sets the character sequence associated with this entry */ | 156 | /** Sets the character sequence associated with this entry */ |
2630 | 157 | void setText(const QByteArray& text); | 157 | void setText(const QByteArray& text); |
2631 | 158 | 158 | ||
2633 | 159 | /** | 159 | /** |
2634 | 160 | * Returns the character sequence associated with this entry, | 160 | * Returns the character sequence associated with this entry, |
2635 | 161 | * with any non-printable characters replaced with escape sequences. | 161 | * with any non-printable characters replaced with escape sequences. |
2636 | 162 | * | 162 | * |
2637 | @@ -173,13 +173,13 @@ | |||
2638 | 173 | /** Sets the character code associated with this entry */ | 173 | /** Sets the character code associated with this entry */ |
2639 | 174 | void setKeyCode(int keyCode); | 174 | void setKeyCode(int keyCode); |
2640 | 175 | 175 | ||
2643 | 176 | /** | 176 | /** |
2644 | 177 | * Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry. | 177 | * Returns a bitwise-OR of the enabled keyboard modifiers associated with this entry. |
2645 | 178 | * If a modifier is set in modifierMask() but not in modifiers(), this means that the entry | 178 | * If a modifier is set in modifierMask() but not in modifiers(), this means that the entry |
2646 | 179 | * only matches when that modifier is NOT pressed. | 179 | * only matches when that modifier is NOT pressed. |
2647 | 180 | * | 180 | * |
2648 | 181 | * If a modifier is not set in modifierMask() then the entry matches whether the modifier | 181 | * If a modifier is not set in modifierMask() then the entry matches whether the modifier |
2650 | 182 | * is pressed or not. | 182 | * is pressed or not. |
2651 | 183 | */ | 183 | */ |
2652 | 184 | Qt::KeyboardModifiers modifiers() const; | 184 | Qt::KeyboardModifiers modifiers() const; |
2653 | 185 | 185 | ||
2654 | @@ -191,13 +191,13 @@ | |||
2655 | 191 | /** See modifierMask() and modifiers() */ | 191 | /** See modifierMask() and modifiers() */ |
2656 | 192 | void setModifierMask( Qt::KeyboardModifiers modifiers ); | 192 | void setModifierMask( Qt::KeyboardModifiers modifiers ); |
2657 | 193 | 193 | ||
2661 | 194 | /** | 194 | /** |
2662 | 195 | * Returns a bitwise-OR of the enabled state flags associated with this entry. | 195 | * Returns a bitwise-OR of the enabled state flags associated with this entry. |
2663 | 196 | * If flag is set in stateMask() but not in state(), this means that the entry only | 196 | * If flag is set in stateMask() but not in state(), this means that the entry only |
2664 | 197 | * matches when the terminal is NOT in that state. | 197 | * matches when the terminal is NOT in that state. |
2665 | 198 | * | 198 | * |
2666 | 199 | * If a state is not set in stateMask() then the entry matches whether the terminal | 199 | * If a state is not set in stateMask() then the entry matches whether the terminal |
2668 | 200 | * is in that state or not. | 200 | * is in that state or not. |
2669 | 201 | */ | 201 | */ |
2670 | 202 | States state() const; | 202 | States state() const; |
2671 | 203 | 203 | ||
2672 | @@ -209,13 +209,13 @@ | |||
2673 | 209 | /** See stateMask() */ | 209 | /** See stateMask() */ |
2674 | 210 | void setStateMask( States mask ); | 210 | void setStateMask( States mask ); |
2675 | 211 | 211 | ||
2678 | 212 | /** | 212 | /** |
2679 | 213 | * Returns the key code and modifiers associated with this entry | 213 | * Returns the key code and modifiers associated with this entry |
2680 | 214 | * as a QKeySequence | 214 | * as a QKeySequence |
2681 | 215 | */ | 215 | */ |
2682 | 216 | //QKeySequence keySequence() const; | 216 | //QKeySequence keySequence() const; |
2683 | 217 | 217 | ||
2685 | 218 | /** | 218 | /** |
2686 | 219 | * Returns this entry's conditions ( ie. its key code, modifier and state criteria ) | 219 | * Returns this entry's conditions ( ie. its key code, modifier and state criteria ) |
2687 | 220 | * as a string. | 220 | * as a string. |
2688 | 221 | */ | 221 | */ |
2689 | @@ -231,16 +231,16 @@ | |||
2690 | 231 | QString resultToString(bool expandWildCards = false, | 231 | QString resultToString(bool expandWildCards = false, |
2691 | 232 | Qt::KeyboardModifiers modifiers = Qt::NoModifier) const; | 232 | Qt::KeyboardModifiers modifiers = Qt::NoModifier) const; |
2692 | 233 | 233 | ||
2694 | 234 | /** | 234 | /** |
2695 | 235 | * Returns true if this entry matches the given key sequence, specified | 235 | * Returns true if this entry matches the given key sequence, specified |
2696 | 236 | * as a combination of @p keyCode , @p modifiers and @p state. | 236 | * as a combination of @p keyCode , @p modifiers and @p state. |
2697 | 237 | */ | 237 | */ |
2700 | 238 | bool matches( int keyCode , | 238 | bool matches( int keyCode , |
2701 | 239 | Qt::KeyboardModifiers modifiers , | 239 | Qt::KeyboardModifiers modifiers , |
2702 | 240 | States flags ) const; | 240 | States flags ) const; |
2703 | 241 | 241 | ||
2704 | 242 | bool operator==(const Entry& rhs) const; | 242 | bool operator==(const Entry& rhs) const; |
2706 | 243 | 243 | ||
2707 | 244 | private: | 244 | private: |
2708 | 245 | void insertModifier( QString& item , int modifier ) const; | 245 | void insertModifier( QString& item , int modifier ) const; |
2709 | 246 | void insertState( QString& item , int state ) const; | 246 | void insertState( QString& item , int state ) const; |
2710 | @@ -258,7 +258,7 @@ | |||
2711 | 258 | 258 | ||
2712 | 259 | /** Constructs a new keyboard translator with the given @p name */ | 259 | /** Constructs a new keyboard translator with the given @p name */ |
2713 | 260 | KeyboardTranslator(const QString& name); | 260 | KeyboardTranslator(const QString& name); |
2715 | 261 | 261 | ||
2716 | 262 | //KeyboardTranslator(const KeyboardTranslator& other); | 262 | //KeyboardTranslator(const KeyboardTranslator& other); |
2717 | 263 | 263 | ||
2718 | 264 | /** Returns the name of this keyboard translator */ | 264 | /** Returns the name of this keyboard translator */ |
2719 | @@ -276,7 +276,7 @@ | |||
2720 | 276 | /** | 276 | /** |
2721 | 277 | * Looks for an entry in this keyboard translator which matches the given | 277 | * Looks for an entry in this keyboard translator which matches the given |
2722 | 278 | * key code, keyboard modifiers and state flags. | 278 | * key code, keyboard modifiers and state flags. |
2724 | 279 | * | 279 | * |
2725 | 280 | * Returns the matching entry if found or a null Entry otherwise ( ie. | 280 | * Returns the matching entry if found or a null Entry otherwise ( ie. |
2726 | 281 | * entry.isNull() will return true ) | 281 | * entry.isNull() will return true ) |
2727 | 282 | * | 282 | * |
2728 | @@ -284,11 +284,11 @@ | |||
2729 | 284 | * @param modifiers A combination of modifiers | 284 | * @param modifiers A combination of modifiers |
2730 | 285 | * @param state Optional flags which specify the current state of the terminal | 285 | * @param state Optional flags which specify the current state of the terminal |
2731 | 286 | */ | 286 | */ |
2734 | 287 | Entry findEntry(int keyCode , | 287 | Entry findEntry(int keyCode , |
2735 | 288 | Qt::KeyboardModifiers modifiers , | 288 | Qt::KeyboardModifiers modifiers , |
2736 | 289 | States state = NoState) const; | 289 | States state = NoState) const; |
2737 | 290 | 290 | ||
2739 | 291 | /** | 291 | /** |
2740 | 292 | * Adds an entry to this keyboard translator's table. Entries can be looked up according | 292 | * Adds an entry to this keyboard translator's table. Entries can be looked up according |
2741 | 293 | * to their key sequence using findEntry() | 293 | * to their key sequence using findEntry() |
2742 | 294 | */ | 294 | */ |
2743 | @@ -319,8 +319,8 @@ | |||
2744 | 319 | Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardTranslator::States) | 319 | Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardTranslator::States) |
2745 | 320 | Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardTranslator::Commands) | 320 | Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardTranslator::Commands) |
2746 | 321 | 321 | ||
2749 | 322 | /** | 322 | /** |
2750 | 323 | * Parses the contents of a Keyboard Translator (.keytab) file and | 323 | * Parses the contents of a Keyboard Translator (.keytab) file and |
2751 | 324 | * returns the entries found in it. | 324 | * returns the entries found in it. |
2752 | 325 | * | 325 | * |
2753 | 326 | * Usage example: | 326 | * Usage example: |
2754 | @@ -340,7 +340,7 @@ | |||
2755 | 340 | * if ( !reader.parseError() ) | 340 | * if ( !reader.parseError() ) |
2756 | 341 | * { | 341 | * { |
2757 | 342 | * // parsing succeeded, do something with the translator | 342 | * // parsing succeeded, do something with the translator |
2759 | 343 | * } | 343 | * } |
2760 | 344 | * else | 344 | * else |
2761 | 345 | * { | 345 | * { |
2762 | 346 | * // parsing failed | 346 | * // parsing failed |
2763 | @@ -353,18 +353,18 @@ | |||
2764 | 353 | /** Constructs a new reader which parses the given @p source */ | 353 | /** Constructs a new reader which parses the given @p source */ |
2765 | 354 | KeyboardTranslatorReader( QIODevice* source ); | 354 | KeyboardTranslatorReader( QIODevice* source ); |
2766 | 355 | 355 | ||
2770 | 356 | /** | 356 | /** |
2771 | 357 | * Returns the description text. | 357 | * Returns the description text. |
2772 | 358 | * TODO: More documentation | 358 | * TODO: More documentation |
2773 | 359 | */ | 359 | */ |
2774 | 360 | QString description() const; | 360 | QString description() const; |
2775 | 361 | 361 | ||
2776 | 362 | /** Returns true if there is another entry in the source stream */ | 362 | /** Returns true if there is another entry in the source stream */ |
2777 | 363 | bool hasNextEntry(); | 363 | bool hasNextEntry(); |
2778 | 364 | /** Returns the next entry found in the source stream */ | 364 | /** Returns the next entry found in the source stream */ |
2780 | 365 | KeyboardTranslator::Entry nextEntry(); | 365 | KeyboardTranslator::Entry nextEntry(); |
2781 | 366 | 366 | ||
2783 | 367 | /** | 367 | /** |
2784 | 368 | * Returns true if an error occurred whilst parsing the input or | 368 | * Returns true if an error occurred whilst parsing the input or |
2785 | 369 | * false if no error occurred. | 369 | * false if no error occurred. |
2786 | 370 | */ | 370 | */ |
2787 | @@ -374,7 +374,7 @@ | |||
2788 | 374 | * Parses a condition and result string for a translator entry | 374 | * Parses a condition and result string for a translator entry |
2789 | 375 | * and produces a keyboard translator entry. | 375 | * and produces a keyboard translator entry. |
2790 | 376 | * | 376 | * |
2792 | 377 | * The condition and result strings are in the same format as in | 377 | * The condition and result strings are in the same format as in |
2793 | 378 | */ | 378 | */ |
2794 | 379 | static KeyboardTranslator::Entry createEntry( const QString& condition , | 379 | static KeyboardTranslator::Entry createEntry( const QString& condition , |
2795 | 380 | const QString& result ); | 380 | const QString& result ); |
2796 | @@ -395,7 +395,7 @@ | |||
2797 | 395 | }; | 395 | }; |
2798 | 396 | QList<Token> tokenize(const QString&); | 396 | QList<Token> tokenize(const QString&); |
2799 | 397 | void readNext(); | 397 | void readNext(); |
2801 | 398 | bool decodeSequence(const QString& , | 398 | bool decodeSequence(const QString& , |
2802 | 399 | int& keyCode, | 399 | int& keyCode, |
2803 | 400 | Qt::KeyboardModifiers& modifiers, | 400 | Qt::KeyboardModifiers& modifiers, |
2804 | 401 | Qt::KeyboardModifiers& modifierMask, | 401 | Qt::KeyboardModifiers& modifierMask, |
2805 | @@ -417,23 +417,23 @@ | |||
2806 | 417 | class KeyboardTranslatorWriter | 417 | class KeyboardTranslatorWriter |
2807 | 418 | { | 418 | { |
2808 | 419 | public: | 419 | public: |
2810 | 420 | /** | 420 | /** |
2811 | 421 | * Constructs a new writer which saves data into @p destination. | 421 | * Constructs a new writer which saves data into @p destination. |
2812 | 422 | * The caller is responsible for closing the device when writing is complete. | 422 | * The caller is responsible for closing the device when writing is complete. |
2813 | 423 | */ | 423 | */ |
2814 | 424 | KeyboardTranslatorWriter(QIODevice* destination); | 424 | KeyboardTranslatorWriter(QIODevice* destination); |
2815 | 425 | ~KeyboardTranslatorWriter(); | 425 | ~KeyboardTranslatorWriter(); |
2816 | 426 | 426 | ||
2820 | 427 | /** | 427 | /** |
2821 | 428 | * Writes the header for the keyboard translator. | 428 | * Writes the header for the keyboard translator. |
2822 | 429 | * @param description Description of the keyboard translator. | 429 | * @param description Description of the keyboard translator. |
2823 | 430 | */ | 430 | */ |
2824 | 431 | void writeHeader( const QString& description ); | 431 | void writeHeader( const QString& description ); |
2825 | 432 | /** Writes a translator entry. */ | 432 | /** Writes a translator entry. */ |
2827 | 433 | void writeEntry( const KeyboardTranslator::Entry& entry ); | 433 | void writeEntry( const KeyboardTranslator::Entry& entry ); |
2828 | 434 | 434 | ||
2829 | 435 | private: | 435 | private: |
2831 | 436 | QIODevice* _destination; | 436 | QIODevice* _destination; |
2832 | 437 | QTextStream* _writer; | 437 | QTextStream* _writer; |
2833 | 438 | }; | 438 | }; |
2834 | 439 | 439 | ||
2835 | @@ -444,7 +444,7 @@ | |||
2836 | 444 | class KONSOLEPRIVATE_EXPORT KeyboardTranslatorManager | 444 | class KONSOLEPRIVATE_EXPORT KeyboardTranslatorManager |
2837 | 445 | { | 445 | { |
2838 | 446 | public: | 446 | public: |
2840 | 447 | /** | 447 | /** |
2841 | 448 | * Constructs a new KeyboardTranslatorManager and loads the list of | 448 | * Constructs a new KeyboardTranslatorManager and loads the list of |
2842 | 449 | * available keyboard translations. | 449 | * available keyboard translations. |
2843 | 450 | * | 450 | * |
2844 | @@ -455,7 +455,7 @@ | |||
2845 | 455 | ~KeyboardTranslatorManager(); | 455 | ~KeyboardTranslatorManager(); |
2846 | 456 | 456 | ||
2847 | 457 | /** | 457 | /** |
2849 | 458 | * Adds a new translator. If a translator with the same name | 458 | * Adds a new translator. If a translator with the same name |
2850 | 459 | * already exists, it will be replaced by the new translator. | 459 | * already exists, it will be replaced by the new translator. |
2851 | 460 | * | 460 | * |
2852 | 461 | * TODO: More documentation. | 461 | * TODO: More documentation. |
2853 | @@ -472,18 +472,18 @@ | |||
2854 | 472 | /** Returns the default translator for Konsole. */ | 472 | /** Returns the default translator for Konsole. */ |
2855 | 473 | const KeyboardTranslator* defaultTranslator(); | 473 | const KeyboardTranslator* defaultTranslator(); |
2856 | 474 | 474 | ||
2858 | 475 | /** | 475 | /** |
2859 | 476 | * Returns the keyboard translator with the given name or 0 if no translator | 476 | * Returns the keyboard translator with the given name or 0 if no translator |
2860 | 477 | * with that name exists. | 477 | * with that name exists. |
2861 | 478 | * | 478 | * |
2862 | 479 | * The first time that a translator with a particular name is requested, | 479 | * The first time that a translator with a particular name is requested, |
2864 | 480 | * the on-disk .keyboard file is loaded and parsed. | 480 | * the on-disk .keyboard file is loaded and parsed. |
2865 | 481 | */ | 481 | */ |
2866 | 482 | const KeyboardTranslator* findTranslator(const QString& name); | 482 | const KeyboardTranslator* findTranslator(const QString& name); |
2867 | 483 | /** | 483 | /** |
2868 | 484 | * Returns a list of the names of available keyboard translators. | 484 | * Returns a list of the names of available keyboard translators. |
2869 | 485 | * | 485 | * |
2871 | 486 | * The first time this is called, a search for available | 486 | * The first time this is called, a search for available |
2872 | 487 | * translators is started. | 487 | * translators is started. |
2873 | 488 | */ | 488 | */ |
2874 | 489 | QList<QString> allTranslators(); | 489 | QList<QString> allTranslators(); |
2875 | @@ -493,15 +493,15 @@ | |||
2876 | 493 | 493 | ||
2877 | 494 | private: | 494 | private: |
2878 | 495 | static const QByteArray defaultTranslatorText; | 495 | static const QByteArray defaultTranslatorText; |
2880 | 496 | 496 | ||
2881 | 497 | void findTranslators(); // locate the available translators | 497 | void findTranslators(); // locate the available translators |
2883 | 498 | KeyboardTranslator* loadTranslator(const QString& name); // loads the translator | 498 | KeyboardTranslator* loadTranslator(const QString& name); // loads the translator |
2884 | 499 | // with the given name | 499 | // with the given name |
2885 | 500 | KeyboardTranslator* loadTranslator(QIODevice* device,const QString& name); | 500 | KeyboardTranslator* loadTranslator(QIODevice* device,const QString& name); |
2886 | 501 | 501 | ||
2887 | 502 | bool saveTranslator(const KeyboardTranslator* translator); | 502 | bool saveTranslator(const KeyboardTranslator* translator); |
2888 | 503 | QString findTranslatorPath(const QString& name); | 503 | QString findTranslatorPath(const QString& name); |
2890 | 504 | 504 | ||
2891 | 505 | QHash<QString,KeyboardTranslator*> _translators; // maps translator-name -> KeyboardTranslator | 505 | QHash<QString,KeyboardTranslator*> _translators; // maps translator-name -> KeyboardTranslator |
2892 | 506 | // instance | 506 | // instance |
2893 | 507 | bool _haveLoadedAll; | 507 | bool _haveLoadedAll; |
2894 | @@ -512,15 +512,15 @@ | |||
2895 | 512 | inline int KeyboardTranslator::Entry::keyCode() const { return _keyCode; } | 512 | inline int KeyboardTranslator::Entry::keyCode() const { return _keyCode; } |
2896 | 513 | inline void KeyboardTranslator::Entry::setKeyCode(int keyCode) { _keyCode = keyCode; } | 513 | inline void KeyboardTranslator::Entry::setKeyCode(int keyCode) { _keyCode = keyCode; } |
2897 | 514 | 514 | ||
2900 | 515 | inline void KeyboardTranslator::Entry::setModifiers( Qt::KeyboardModifiers modifier ) | 515 | inline void KeyboardTranslator::Entry::setModifiers( Qt::KeyboardModifiers modifier ) |
2901 | 516 | { | 516 | { |
2902 | 517 | _modifiers = modifier; | 517 | _modifiers = modifier; |
2903 | 518 | } | 518 | } |
2904 | 519 | inline Qt::KeyboardModifiers KeyboardTranslator::Entry::modifiers() const { return _modifiers; } | 519 | inline Qt::KeyboardModifiers KeyboardTranslator::Entry::modifiers() const { return _modifiers; } |
2905 | 520 | 520 | ||
2909 | 521 | inline void KeyboardTranslator::Entry::setModifierMask( Qt::KeyboardModifiers mask ) | 521 | inline void KeyboardTranslator::Entry::setModifierMask( Qt::KeyboardModifiers mask ) |
2910 | 522 | { | 522 | { |
2911 | 523 | _modifierMask = mask; | 523 | _modifierMask = mask; |
2912 | 524 | } | 524 | } |
2913 | 525 | inline Qt::KeyboardModifiers KeyboardTranslator::Entry::modifierMask() const { return _modifierMask; } | 525 | inline Qt::KeyboardModifiers KeyboardTranslator::Entry::modifierMask() const { return _modifierMask; } |
2914 | 526 | 526 | ||
2915 | @@ -530,23 +530,23 @@ | |||
2916 | 530 | } | 530 | } |
2917 | 531 | 531 | ||
2918 | 532 | inline void KeyboardTranslator::Entry::setCommand( Command command ) | 532 | inline void KeyboardTranslator::Entry::setCommand( Command command ) |
2921 | 533 | { | 533 | { |
2922 | 534 | _command = command; | 534 | _command = command; |
2923 | 535 | } | 535 | } |
2924 | 536 | inline KeyboardTranslator::Command KeyboardTranslator::Entry::command() const { return _command; } | 536 | inline KeyboardTranslator::Command KeyboardTranslator::Entry::command() const { return _command; } |
2925 | 537 | 537 | ||
2926 | 538 | inline void KeyboardTranslator::Entry::setText( const QByteArray& text ) | 538 | inline void KeyboardTranslator::Entry::setText( const QByteArray& text ) |
2928 | 539 | { | 539 | { |
2929 | 540 | _text = unescape(text); | 540 | _text = unescape(text); |
2930 | 541 | } | 541 | } |
2931 | 542 | inline int oneOrZero(int value) | 542 | inline int oneOrZero(int value) |
2932 | 543 | { | 543 | { |
2933 | 544 | return value ? 1 : 0; | 544 | return value ? 1 : 0; |
2934 | 545 | } | 545 | } |
2936 | 546 | inline QByteArray KeyboardTranslator::Entry::text(bool expandWildCards,Qt::KeyboardModifiers modifiers) const | 546 | inline QByteArray KeyboardTranslator::Entry::text(bool expandWildCards,Qt::KeyboardModifiers modifiers) const |
2937 | 547 | { | 547 | { |
2938 | 548 | QByteArray expandedText = _text; | 548 | QByteArray expandedText = _text; |
2940 | 549 | 549 | ||
2941 | 550 | if (expandWildCards) | 550 | if (expandWildCards) |
2942 | 551 | { | 551 | { |
2943 | 552 | int modifierValue = 1; | 552 | int modifierValue = 1; |
2944 | @@ -554,25 +554,25 @@ | |||
2945 | 554 | modifierValue += oneOrZero(modifiers & Qt::AltModifier) << 1; | 554 | modifierValue += oneOrZero(modifiers & Qt::AltModifier) << 1; |
2946 | 555 | modifierValue += oneOrZero(modifiers & Qt::ControlModifier) << 2; | 555 | modifierValue += oneOrZero(modifiers & Qt::ControlModifier) << 2; |
2947 | 556 | 556 | ||
2949 | 557 | for (int i=0;i<_text.length();i++) | 557 | for (int i=0;i<_text.length();i++) |
2950 | 558 | { | 558 | { |
2951 | 559 | if (expandedText[i] == '*') | 559 | if (expandedText[i] == '*') |
2952 | 560 | expandedText[i] = '0' + modifierValue; | 560 | expandedText[i] = '0' + modifierValue; |
2953 | 561 | } | 561 | } |
2954 | 562 | } | 562 | } |
2955 | 563 | 563 | ||
2957 | 564 | return expandedText; | 564 | return expandedText; |
2958 | 565 | } | 565 | } |
2959 | 566 | 566 | ||
2960 | 567 | inline void KeyboardTranslator::Entry::setState( States state ) | 567 | inline void KeyboardTranslator::Entry::setState( States state ) |
2963 | 568 | { | 568 | { |
2964 | 569 | _state = state; | 569 | _state = state; |
2965 | 570 | } | 570 | } |
2966 | 571 | inline KeyboardTranslator::States KeyboardTranslator::Entry::state() const { return _state; } | 571 | inline KeyboardTranslator::States KeyboardTranslator::Entry::state() const { return _state; } |
2967 | 572 | 572 | ||
2968 | 573 | inline void KeyboardTranslator::Entry::setStateMask( States stateMask ) | 573 | inline void KeyboardTranslator::Entry::setStateMask( States stateMask ) |
2971 | 574 | { | 574 | { |
2972 | 575 | _stateMask = stateMask; | 575 | _stateMask = stateMask; |
2973 | 576 | } | 576 | } |
2974 | 577 | inline KeyboardTranslator::States KeyboardTranslator::Entry::stateMask() const { return _stateMask; } | 577 | inline KeyboardTranslator::States KeyboardTranslator::Entry::stateMask() const { return _stateMask; } |
2975 | 578 | 578 | ||
2976 | 579 | 579 | ||
2977 | === modified file 'src/plugin/konsole/Pty.cpp' | |||
2978 | --- src/plugin/konsole/Pty.cpp 2014-04-27 09:11:14 +0000 | |||
2979 | +++ src/plugin/konsole/Pty.cpp 2014-07-30 09:50:10 +0000 | |||
2980 | @@ -81,7 +81,7 @@ | |||
2981 | 81 | pty()->tcGetAttr(&ttmode); | 81 | pty()->tcGetAttr(&ttmode); |
2982 | 82 | return ttmode.c_iflag & IXOFF && | 82 | return ttmode.c_iflag & IXOFF && |
2983 | 83 | ttmode.c_iflag & IXON; | 83 | ttmode.c_iflag & IXON; |
2985 | 84 | } | 84 | } |
2986 | 85 | qWarning() << "Unable to get flow control status, terminal not connected."; | 85 | qWarning() << "Unable to get flow control status, terminal not connected."; |
2987 | 86 | return false; | 86 | return false; |
2988 | 87 | } | 87 | } |
2989 | @@ -108,7 +108,7 @@ | |||
2990 | 108 | void Pty::setErase(char erase) | 108 | void Pty::setErase(char erase) |
2991 | 109 | { | 109 | { |
2992 | 110 | _eraseChar = erase; | 110 | _eraseChar = erase; |
2994 | 111 | 111 | ||
2995 | 112 | if (pty()->masterFd() >= 0) | 112 | if (pty()->masterFd() >= 0) |
2996 | 113 | { | 113 | { |
2997 | 114 | struct ::termios ttmode; | 114 | struct ::termios ttmode; |
2998 | @@ -140,7 +140,7 @@ | |||
2999 | 140 | 140 | ||
3000 | 141 | // split on the first '=' character | 141 | // split on the first '=' character |
3001 | 142 | int pos = pair.indexOf('='); | 142 | int pos = pair.indexOf('='); |
3003 | 143 | 143 | ||
3004 | 144 | if ( pos >= 0 ) | 144 | if ( pos >= 0 ) |
3005 | 145 | { | 145 | { |
3006 | 146 | QString variable = pair.left(pos); | 146 | QString variable = pair.left(pos); |
3007 | @@ -151,10 +151,10 @@ | |||
3008 | 151 | } | 151 | } |
3009 | 152 | } | 152 | } |
3010 | 153 | 153 | ||
3015 | 154 | int Pty::start(const QString& program, | 154 | int Pty::start(const QString& program, |
3016 | 155 | const QStringList& programArguments, | 155 | const QStringList& programArguments, |
3017 | 156 | const QStringList& environment, | 156 | const QStringList& environment, |
3018 | 157 | ulong winid, | 157 | ulong winid, |
3019 | 158 | bool addToUtmp | 158 | bool addToUtmp |
3020 | 159 | //const QString& dbusService, | 159 | //const QString& dbusService, |
3021 | 160 | //const QString& dbusSession | 160 | //const QString& dbusSession |
3022 | @@ -162,7 +162,7 @@ | |||
3023 | 162 | { | 162 | { |
3024 | 163 | clearProgram(); | 163 | clearProgram(); |
3025 | 164 | 164 | ||
3027 | 165 | // For historical reasons, the first argument in programArguments is the | 165 | // For historical reasons, the first argument in programArguments is the |
3028 | 166 | // name of the program to execute, so create a list consisting of all | 166 | // name of the program to execute, so create a list consisting of all |
3029 | 167 | // but the first argument to pass to setProgram() | 167 | // but the first argument to pass to setProgram() |
3030 | 168 | Q_ASSERT(programArguments.count() >= 1); | 168 | Q_ASSERT(programArguments.count() >= 1); |
3031 | @@ -202,10 +202,10 @@ | |||
3032 | 202 | 202 | ||
3033 | 203 | if (_eraseChar != 0) | 203 | if (_eraseChar != 0) |
3034 | 204 | ttmode.c_cc[VERASE] = _eraseChar; | 204 | ttmode.c_cc[VERASE] = _eraseChar; |
3036 | 205 | 205 | ||
3037 | 206 | if (!pty()->tcSetAttr(&ttmode)) | 206 | if (!pty()->tcSetAttr(&ttmode)) |
3038 | 207 | qWarning() << "Unable to set terminal attributes."; | 207 | qWarning() << "Unable to set terminal attributes."; |
3040 | 208 | 208 | ||
3041 | 209 | pty()->setWinSize(_windowLines, _windowColumns); | 209 | pty()->setWinSize(_windowLines, _windowColumns); |
3042 | 210 | 210 | ||
3043 | 211 | KProcess::start(); | 211 | KProcess::start(); |
3044 | @@ -256,15 +256,15 @@ | |||
3045 | 256 | { | 256 | { |
3046 | 257 | if (!length) | 257 | if (!length) |
3047 | 258 | return; | 258 | return; |
3050 | 259 | 259 | ||
3051 | 260 | if (!pty()->write(data,length)) | 260 | if (!pty()->write(data,length)) |
3052 | 261 | { | 261 | { |
3053 | 262 | qWarning() << "Pty::doSendJobs - Could not send input data to terminal process."; | 262 | qWarning() << "Pty::doSendJobs - Could not send input data to terminal process."; |
3054 | 263 | return; | 263 | return; |
3055 | 264 | } | 264 | } |
3056 | 265 | } | 265 | } |
3057 | 266 | 266 | ||
3059 | 267 | void Pty::dataReceived() | 267 | void Pty::dataReceived() |
3060 | 268 | { | 268 | { |
3061 | 269 | QByteArray data = pty()->readAll(); | 269 | QByteArray data = pty()->readAll(); |
3062 | 270 | emit receivedData(data.constData(),data.count()); | 270 | emit receivedData(data.constData(),data.count()); |
3063 | @@ -288,7 +288,7 @@ | |||
3064 | 288 | if ( pid != -1 ) | 288 | if ( pid != -1 ) |
3065 | 289 | { | 289 | { |
3066 | 290 | return pid; | 290 | return pid; |
3068 | 291 | } | 291 | } |
3069 | 292 | 292 | ||
3070 | 293 | return 0; | 293 | return 0; |
3071 | 294 | } | 294 | } |
3072 | @@ -296,9 +296,9 @@ | |||
3073 | 296 | void Pty::setupChildProcess() | 296 | void Pty::setupChildProcess() |
3074 | 297 | { | 297 | { |
3075 | 298 | KPtyProcess::setupChildProcess(); | 298 | KPtyProcess::setupChildProcess(); |
3077 | 299 | 299 | ||
3078 | 300 | // reset all signal handlers | 300 | // reset all signal handlers |
3080 | 301 | // this ensures that terminal applications respond to | 301 | // this ensures that terminal applications respond to |
3081 | 302 | // signals generated via key sequences such as Ctrl+C | 302 | // signals generated via key sequences such as Ctrl+C |
3082 | 303 | // (which sends SIGINT) | 303 | // (which sends SIGINT) |
3083 | 304 | struct sigaction action; | 304 | struct sigaction action; |
3084 | 305 | 305 | ||
3085 | === modified file 'src/plugin/konsole/Pty.h' | |||
3086 | --- src/plugin/konsole/Pty.h 2014-04-27 09:11:14 +0000 | |||
3087 | +++ src/plugin/konsole/Pty.h 2014-07-30 09:50:10 +0000 | |||
3088 | @@ -7,8 +7,8 @@ | |||
3089 | 7 | */ | 7 | */ |
3090 | 8 | 8 | ||
3091 | 9 | /* | 9 | /* |
3094 | 10 | This file is part of Konsole, KDE's terminal emulator. | 10 | This file is part of Konsole, KDE's terminal emulator. |
3095 | 11 | 11 | ||
3096 | 12 | Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> | 12 | Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> |
3097 | 13 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> | 13 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> |
3098 | 14 | 14 | ||
3099 | @@ -42,8 +42,8 @@ | |||
3100 | 42 | 42 | ||
3101 | 43 | 43 | ||
3102 | 44 | /** | 44 | /** |
3105 | 45 | * The Pty class is used to start the terminal process, | 45 | * The Pty class is used to start the terminal process, |
3106 | 46 | * send data to it, receive data from it and manipulate | 46 | * send data to it, receive data from it and manipulate |
3107 | 47 | * various properties of the pseudo-teletype interface | 47 | * various properties of the pseudo-teletype interface |
3108 | 48 | * used to communicate with the process. | 48 | * used to communicate with the process. |
3109 | 49 | * | 49 | * |
3110 | @@ -52,26 +52,26 @@ | |||
3111 | 52 | * send data to or receive data from the process. | 52 | * send data to or receive data from the process. |
3112 | 53 | * | 53 | * |
3113 | 54 | * To start the terminal process, call the start() method | 54 | * To start the terminal process, call the start() method |
3115 | 55 | * with the program name and appropriate arguments. | 55 | * with the program name and appropriate arguments. |
3116 | 56 | */ | 56 | */ |
3117 | 57 | class Pty: public KPtyProcess | 57 | class Pty: public KPtyProcess |
3118 | 58 | { | 58 | { |
3119 | 59 | Q_OBJECT | 59 | Q_OBJECT |
3120 | 60 | 60 | ||
3121 | 61 | public: | 61 | public: |
3124 | 62 | 62 | ||
3125 | 63 | /** | 63 | /** |
3126 | 64 | * Constructs a new Pty. | 64 | * Constructs a new Pty. |
3128 | 65 | * | 65 | * |
3129 | 66 | * Connect to the sendData() slot and receivedData() signal to prepare | 66 | * Connect to the sendData() slot and receivedData() signal to prepare |
3130 | 67 | * for sending and receiving data from the terminal process. | 67 | * for sending and receiving data from the terminal process. |
3131 | 68 | * | 68 | * |
3133 | 69 | * To start the terminal process, call the run() method with the | 69 | * To start the terminal process, call the run() method with the |
3134 | 70 | * name of the program to start and appropriate arguments. | 70 | * name of the program to start and appropriate arguments. |
3135 | 71 | */ | 71 | */ |
3136 | 72 | explicit Pty(QObject* parent = 0); | 72 | explicit Pty(QObject* parent = 0); |
3137 | 73 | 73 | ||
3139 | 74 | /** | 74 | /** |
3140 | 75 | * Construct a process using an open pty master. | 75 | * Construct a process using an open pty master. |
3141 | 76 | * See KPtyProcess::KPtyProcess() | 76 | * See KPtyProcess::KPtyProcess() |
3142 | 77 | */ | 77 | */ |
3143 | @@ -80,7 +80,7 @@ | |||
3144 | 80 | ~Pty(); | 80 | ~Pty(); |
3145 | 81 | 81 | ||
3146 | 82 | /** | 82 | /** |
3148 | 83 | * Starts the terminal process. | 83 | * Starts the terminal process. |
3149 | 84 | * | 84 | * |
3150 | 85 | * Returns 0 if the process was started successfully or non-zero | 85 | * Returns 0 if the process was started successfully or non-zero |
3151 | 86 | * otherwise. | 86 | * otherwise. |
3152 | @@ -93,23 +93,23 @@ | |||
3153 | 93 | * @param winid Specifies the value of the WINDOWID environment variable | 93 | * @param winid Specifies the value of the WINDOWID environment variable |
3154 | 94 | * in the process's environment. | 94 | * in the process's environment. |
3155 | 95 | * @param addToUtmp Specifies whether a utmp entry should be created for | 95 | * @param addToUtmp Specifies whether a utmp entry should be created for |
3158 | 96 | * the pty used. See K3Process::setUsePty() | 96 | * the pty used. See K3Process::setUsePty() |
3159 | 97 | * @param dbusService Specifies the value of the KONSOLE_DBUS_SERVICE | 97 | * @param dbusService Specifies the value of the KONSOLE_DBUS_SERVICE |
3160 | 98 | * environment variable in the process's environment. | 98 | * environment variable in the process's environment. |
3161 | 99 | * @param dbusSession Specifies the value of the KONSOLE_DBUS_SESSION | 99 | * @param dbusSession Specifies the value of the KONSOLE_DBUS_SESSION |
3163 | 100 | * environment variable in the process's environment. | 100 | * environment variable in the process's environment. |
3164 | 101 | */ | 101 | */ |
3169 | 102 | int start( const QString& program, | 102 | int start( const QString& program, |
3170 | 103 | const QStringList& arguments, | 103 | const QStringList& arguments, |
3171 | 104 | const QStringList& environment, | 104 | const QStringList& environment, |
3172 | 105 | ulong winid, | 105 | ulong winid, |
3173 | 106 | bool addToUtmp | 106 | bool addToUtmp |
3174 | 107 | ); | 107 | ); |
3175 | 108 | 108 | ||
3176 | 109 | /** TODO: Document me */ | 109 | /** TODO: Document me */ |
3177 | 110 | void setWriteable(bool writeable); | 110 | void setWriteable(bool writeable); |
3178 | 111 | 111 | ||
3180 | 112 | /** | 112 | /** |
3181 | 113 | * Enables or disables Xon/Xoff flow control. The flow control setting | 113 | * Enables or disables Xon/Xoff flow control. The flow control setting |
3182 | 114 | * may be changed later by a terminal application, so flowControlEnabled() | 114 | * may be changed later by a terminal application, so flowControlEnabled() |
3183 | 115 | * may not equal the value of @p on in the previous call to setFlowControlEnabled() | 115 | * may not equal the value of @p on in the previous call to setFlowControlEnabled() |
3184 | @@ -119,12 +119,12 @@ | |||
3185 | 119 | /** Queries the terminal state and returns true if Xon/Xoff flow control is enabled. */ | 119 | /** Queries the terminal state and returns true if Xon/Xoff flow control is enabled. */ |
3186 | 120 | bool flowControlEnabled() const; | 120 | bool flowControlEnabled() const; |
3187 | 121 | 121 | ||
3190 | 122 | /** | 122 | /** |
3191 | 123 | * Sets the size of the window (in lines and columns of characters) | 123 | * Sets the size of the window (in lines and columns of characters) |
3192 | 124 | * used by this teletype. | 124 | * used by this teletype. |
3193 | 125 | */ | 125 | */ |
3194 | 126 | void setWindowSize(int lines, int cols); | 126 | void setWindowSize(int lines, int cols); |
3196 | 127 | 127 | ||
3197 | 128 | /** Returns the size of the window used by this teletype. See setWindowSize() */ | 128 | /** Returns the size of the window used by this teletype. See setWindowSize() */ |
3198 | 129 | QSize windowSize() const; | 129 | QSize windowSize() const; |
3199 | 130 | 130 | ||
3200 | @@ -143,7 +143,7 @@ | |||
3201 | 143 | * 0 will be returned. | 143 | * 0 will be returned. |
3202 | 144 | */ | 144 | */ |
3203 | 145 | int foregroundProcessGroup() const; | 145 | int foregroundProcessGroup() const; |
3205 | 146 | 146 | ||
3206 | 147 | public slots: | 147 | public slots: |
3207 | 148 | 148 | ||
3208 | 149 | /** | 149 | /** |
3209 | @@ -152,7 +152,7 @@ | |||
3210 | 152 | void setUtf8Mode(bool on); | 152 | void setUtf8Mode(bool on); |
3211 | 153 | 153 | ||
3212 | 154 | /** | 154 | /** |
3214 | 155 | * Suspend or resume processing of data from the standard | 155 | * Suspend or resume processing of data from the standard |
3215 | 156 | * output of the terminal process. | 156 | * output of the terminal process. |
3216 | 157 | * | 157 | * |
3217 | 158 | * See K3Process::suspend() and K3Process::resume() | 158 | * See K3Process::suspend() and K3Process::resume() |
3218 | @@ -161,9 +161,9 @@ | |||
3219 | 161 | * otherwise processing is resumed. | 161 | * otherwise processing is resumed. |
3220 | 162 | */ | 162 | */ |
3221 | 163 | void lockPty(bool lock); | 163 | void lockPty(bool lock); |
3225 | 164 | 164 | ||
3226 | 165 | /** | 165 | /** |
3227 | 166 | * Sends data to the process currently controlling the | 166 | * Sends data to the process currently controlling the |
3228 | 167 | * teletype ( whose id is returned by foregroundProcessGroup() ) | 167 | * teletype ( whose id is returned by foregroundProcessGroup() ) |
3229 | 168 | * | 168 | * |
3230 | 169 | * @param buffer Pointer to the data to send. | 169 | * @param buffer Pointer to the data to send. |
3231 | @@ -181,14 +181,14 @@ | |||
3232 | 181 | * @param length Length of @p buffer | 181 | * @param length Length of @p buffer |
3233 | 182 | */ | 182 | */ |
3234 | 183 | void receivedData(const char* buffer, int length); | 183 | void receivedData(const char* buffer, int length); |
3236 | 184 | 184 | ||
3237 | 185 | protected: | 185 | protected: |
3238 | 186 | void setupChildProcess(); | 186 | void setupChildProcess(); |
3239 | 187 | 187 | ||
3240 | 188 | private slots: | 188 | private slots: |
3244 | 189 | // called when data is received from the terminal process | 189 | // called when data is received from the terminal process |
3245 | 190 | void dataReceived(); | 190 | void dataReceived(); |
3246 | 191 | 191 | ||
3247 | 192 | private: | 192 | private: |
3248 | 193 | void init(); | 193 | void init(); |
3249 | 194 | 194 | ||
3250 | @@ -196,7 +196,7 @@ | |||
3251 | 196 | // to the environment for the process | 196 | // to the environment for the process |
3252 | 197 | void addEnvironmentVariables(const QStringList& environment); | 197 | void addEnvironmentVariables(const QStringList& environment); |
3253 | 198 | 198 | ||
3255 | 199 | int _windowColumns; | 199 | int _windowColumns; |
3256 | 200 | int _windowLines; | 200 | int _windowLines; |
3257 | 201 | char _eraseChar; | 201 | char _eraseChar; |
3258 | 202 | bool _xonXoff; | 202 | bool _xonXoff; |
3259 | 203 | 203 | ||
3260 | === modified file 'src/plugin/konsole/Screen.cpp' | |||
3261 | --- src/plugin/konsole/Screen.cpp 2014-04-27 09:11:14 +0000 | |||
3262 | +++ src/plugin/konsole/Screen.cpp 2014-07-30 09:50:10 +0000 | |||
3263 | @@ -50,10 +50,10 @@ | |||
3264 | 50 | 50 | ||
3265 | 51 | //Macro to convert x,y position on screen to position within an image. | 51 | //Macro to convert x,y position on screen to position within an image. |
3266 | 52 | // | 52 | // |
3268 | 53 | //Originally the image was stored as one large contiguous block of | 53 | //Originally the image was stored as one large contiguous block of |
3269 | 54 | //memory, so a position within the image could be represented as an | 54 | //memory, so a position within the image could be represented as an |
3270 | 55 | //offset from the beginning of the block. For efficiency reasons this | 55 | //offset from the beginning of the block. For efficiency reasons this |
3272 | 56 | //is no longer the case. | 56 | //is no longer the case. |
3273 | 57 | //Many internal parts of this class still use this representation for parameters and so on, | 57 | //Many internal parts of this class still use this representation for parameters and so on, |
3274 | 58 | //notably moveImage() and clearImage(). | 58 | //notably moveImage() and clearImage(). |
3275 | 59 | //This macro converts from an X,Y position into an image offset. | 59 | //This macro converts from an X,Y position into an image offset. |
3276 | @@ -198,14 +198,14 @@ | |||
3277 | 198 | Q_ASSERT( n >= 0 ); | 198 | Q_ASSERT( n >= 0 ); |
3278 | 199 | 199 | ||
3279 | 200 | // always delete at least one char | 200 | // always delete at least one char |
3282 | 201 | if (n == 0) | 201 | if (n == 0) |
3283 | 202 | n = 1; | 202 | n = 1; |
3284 | 203 | 203 | ||
3285 | 204 | // if cursor is beyond the end of the line there is nothing to do | 204 | // if cursor is beyond the end of the line there is nothing to do |
3286 | 205 | if ( cuX >= screenLines[cuY].count() ) | 205 | if ( cuX >= screenLines[cuY].count() ) |
3287 | 206 | return; | 206 | return; |
3288 | 207 | 207 | ||
3290 | 208 | if ( cuX+n > screenLines[cuY].count() ) | 208 | if ( cuX+n > screenLines[cuY].count() ) |
3291 | 209 | n = screenLines[cuY].count() - cuX; | 209 | n = screenLines[cuY].count() - cuX; |
3292 | 210 | 210 | ||
3293 | 211 | Q_ASSERT( n >= 0 ); | 211 | Q_ASSERT( n >= 0 ); |
3294 | @@ -285,7 +285,7 @@ | |||
3295 | 285 | { | 285 | { |
3296 | 286 | cuX = qMin(savedState.cursorColumn,columns-1); | 286 | cuX = qMin(savedState.cursorColumn,columns-1); |
3297 | 287 | cuY = qMin(savedState.cursorLine,lines-1); | 287 | cuY = qMin(savedState.cursorLine,lines-1); |
3299 | 288 | currentRendition = savedState.rendition; | 288 | currentRendition = savedState.rendition; |
3300 | 289 | currentForeground = savedState.foreground; | 289 | currentForeground = savedState.foreground; |
3301 | 290 | currentBackground = savedState.background; | 290 | currentBackground = savedState.background; |
3302 | 291 | updateEffectiveRendition(); | 291 | updateEffectiveRendition(); |
3303 | @@ -318,7 +318,7 @@ | |||
3304 | 318 | 318 | ||
3305 | 319 | clearSelection(); | 319 | clearSelection(); |
3306 | 320 | 320 | ||
3308 | 321 | delete[] screenLines; | 321 | delete[] screenLines; |
3309 | 322 | screenLines = newScreenLines; | 322 | screenLines = newScreenLines; |
3310 | 323 | 323 | ||
3311 | 324 | lines = new_lines; | 324 | lines = new_lines; |
3312 | @@ -375,11 +375,11 @@ | |||
3313 | 375 | */ | 375 | */ |
3314 | 376 | 376 | ||
3315 | 377 | void Screen::reverseRendition(Character& p) const | 377 | void Screen::reverseRendition(Character& p) const |
3318 | 378 | { | 378 | { |
3319 | 379 | CharacterColor f = p.foregroundColor; | 379 | CharacterColor f = p.foregroundColor; |
3320 | 380 | CharacterColor b = p.backgroundColor; | 380 | CharacterColor b = p.backgroundColor; |
3321 | 381 | 381 | ||
3323 | 382 | p.foregroundColor = b; | 382 | p.foregroundColor = b; |
3324 | 383 | p.backgroundColor = f; //p->r &= ~RE_TRANSPARENT; | 383 | p.backgroundColor = f; //p->r &= ~RE_TRANSPARENT; |
3325 | 384 | } | 384 | } |
3326 | 385 | 385 | ||
3327 | @@ -405,14 +405,14 @@ | |||
3328 | 405 | { | 405 | { |
3329 | 406 | Q_ASSERT( startLine >= 0 && count > 0 && startLine + count <= history->getLines() ); | 406 | Q_ASSERT( startLine >= 0 && count > 0 && startLine + count <= history->getLines() ); |
3330 | 407 | 407 | ||
3332 | 408 | for (int line = startLine; line < startLine + count; line++) | 408 | for (int line = startLine; line < startLine + count; line++) |
3333 | 409 | { | 409 | { |
3334 | 410 | const int length = qMin(columns,history->getLineLen(line)); | 410 | const int length = qMin(columns,history->getLineLen(line)); |
3335 | 411 | const int destLineOffset = (line-startLine)*columns; | 411 | const int destLineOffset = (line-startLine)*columns; |
3336 | 412 | 412 | ||
3337 | 413 | history->getCells(line,0,length,dest + destLineOffset); | 413 | history->getCells(line,0,length,dest + destLineOffset); |
3338 | 414 | 414 | ||
3340 | 415 | for (int column = length; column < columns; column++) | 415 | for (int column = length; column < columns; column++) |
3341 | 416 | dest[destLineOffset+column] = defaultChar; | 416 | dest[destLineOffset+column] = defaultChar; |
3342 | 417 | 417 | ||
3343 | 418 | // invert selected text | 418 | // invert selected text |
3344 | @@ -420,9 +420,9 @@ | |||
3345 | 420 | { | 420 | { |
3346 | 421 | for (int column = 0; column < columns; column++) | 421 | for (int column = 0; column < columns; column++) |
3347 | 422 | { | 422 | { |
3349 | 423 | if (isSelected(column,line)) | 423 | if (isSelected(column,line)) |
3350 | 424 | { | 424 | { |
3352 | 425 | reverseRendition(dest[destLineOffset + column]); | 425 | reverseRendition(dest[destLineOffset + column]); |
3353 | 426 | } | 426 | } |
3354 | 427 | } | 427 | } |
3355 | 428 | } | 428 | } |
3356 | @@ -439,15 +439,15 @@ | |||
3357 | 439 | int destLineStartIndex = (line-startLine)*columns; | 439 | int destLineStartIndex = (line-startLine)*columns; |
3358 | 440 | 440 | ||
3359 | 441 | for (int column = 0; column < columns; column++) | 441 | for (int column = 0; column < columns; column++) |
3362 | 442 | { | 442 | { |
3363 | 443 | int srcIndex = srcLineStartIndex + column; | 443 | int srcIndex = srcLineStartIndex + column; |
3364 | 444 | int destIndex = destLineStartIndex + column; | 444 | int destIndex = destLineStartIndex + column; |
3365 | 445 | 445 | ||
3366 | 446 | dest[destIndex] = screenLines[srcIndex/columns].value(srcIndex%columns,defaultChar); | 446 | dest[destIndex] = screenLines[srcIndex/columns].value(srcIndex%columns,defaultChar); |
3367 | 447 | 447 | ||
3368 | 448 | // invert selected text | 448 | // invert selected text |
3369 | 449 | if (selBegin != -1 && isSelected(column,line + history->getLines())) | 449 | if (selBegin != -1 && isSelected(column,line + history->getLines())) |
3371 | 450 | reverseRendition(dest[destIndex]); | 450 | reverseRendition(dest[destIndex]); |
3372 | 451 | } | 451 | } |
3373 | 452 | 452 | ||
3374 | 453 | } | 453 | } |
3375 | @@ -460,7 +460,7 @@ | |||
3376 | 460 | 460 | ||
3377 | 461 | const int mergedLines = endLine - startLine + 1; | 461 | const int mergedLines = endLine - startLine + 1; |
3378 | 462 | 462 | ||
3380 | 463 | Q_ASSERT( size >= mergedLines * columns ); | 463 | Q_ASSERT( size >= mergedLines * columns ); |
3381 | 464 | Q_UNUSED( size ); | 464 | Q_UNUSED( size ); |
3382 | 465 | 465 | ||
3383 | 466 | const int linesInHistoryBuffer = qBound(0,history->getLines()-startLine,mergedLines); | 466 | const int linesInHistoryBuffer = qBound(0,history->getLines()-startLine,mergedLines); |
3384 | @@ -468,7 +468,7 @@ | |||
3385 | 468 | 468 | ||
3386 | 469 | // copy lines from history buffer | 469 | // copy lines from history buffer |
3387 | 470 | if (linesInHistoryBuffer > 0) | 470 | if (linesInHistoryBuffer > 0) |
3389 | 471 | copyFromHistory(dest,startLine,linesInHistoryBuffer); | 471 | copyFromHistory(dest,startLine,linesInHistoryBuffer); |
3390 | 472 | 472 | ||
3391 | 473 | // copy lines from screen buffer | 473 | // copy lines from screen buffer |
3392 | 474 | if (linesInScreenBuffer > 0) | 474 | if (linesInScreenBuffer > 0) |
3393 | @@ -491,7 +491,7 @@ | |||
3394 | 491 | 491 | ||
3395 | 492 | QVector<LineProperty> Screen::getLineProperties( int startLine , int endLine ) const | 492 | QVector<LineProperty> Screen::getLineProperties( int startLine , int endLine ) const |
3396 | 493 | { | 493 | { |
3398 | 494 | Q_ASSERT( startLine >= 0 ); | 494 | Q_ASSERT( startLine >= 0 ); |
3399 | 495 | Q_ASSERT( endLine >= startLine && endLine < history->getLines() + lines ); | 495 | Q_ASSERT( endLine >= startLine && endLine < history->getLines() + lines ); |
3400 | 496 | 496 | ||
3401 | 497 | const int mergedLines = endLine-startLine+1; | 497 | const int mergedLines = endLine-startLine+1; |
3402 | @@ -502,7 +502,7 @@ | |||
3403 | 502 | int index = 0; | 502 | int index = 0; |
3404 | 503 | 503 | ||
3405 | 504 | // copy properties for lines in history | 504 | // copy properties for lines in history |
3407 | 505 | for (int line = startLine; line < startLine + linesInHistory; line++) | 505 | for (int line = startLine; line < startLine + linesInHistory; line++) |
3408 | 506 | { | 506 | { |
3409 | 507 | //TODO Support for line properties other than wrapped lines | 507 | //TODO Support for line properties other than wrapped lines |
3410 | 508 | if (history->isWrappedLine(line)) | 508 | if (history->isWrappedLine(line)) |
3411 | @@ -556,7 +556,7 @@ | |||
3412 | 556 | if (screenLines[cuY].size() < cuX+1) | 556 | if (screenLines[cuY].size() < cuX+1) |
3413 | 557 | screenLines[cuY].resize(cuX+1); | 557 | screenLines[cuY].resize(cuX+1); |
3414 | 558 | 558 | ||
3416 | 559 | if (BS_CLEARS) | 559 | if (BS_CLEARS) |
3417 | 560 | screenLines[cuY][cuX].character = ' '; | 560 | screenLines[cuY][cuX].character = ' '; |
3418 | 561 | } | 561 | } |
3419 | 562 | 562 | ||
3420 | @@ -566,8 +566,8 @@ | |||
3421 | 566 | if (n == 0) n = 1; | 566 | if (n == 0) n = 1; |
3422 | 567 | while((n > 0) && (cuX < columns-1)) | 567 | while((n > 0) && (cuX < columns-1)) |
3423 | 568 | { | 568 | { |
3426 | 569 | cursorRight(1); | 569 | cursorRight(1); |
3427 | 570 | while((cuX < columns-1) && !tabStops[cuX]) | 570 | while((cuX < columns-1) && !tabStops[cuX]) |
3428 | 571 | cursorRight(1); | 571 | cursorRight(1); |
3429 | 572 | n--; | 572 | n--; |
3430 | 573 | } | 573 | } |
3431 | @@ -602,20 +602,20 @@ | |||
3432 | 602 | // Arrg! The 1st tabstop has to be one longer than the other. | 602 | // Arrg! The 1st tabstop has to be one longer than the other. |
3433 | 603 | // i.e. the kids start counting from 0 instead of 1. | 603 | // i.e. the kids start counting from 0 instead of 1. |
3434 | 604 | // Other programs might behave correctly. Be aware. | 604 | // Other programs might behave correctly. Be aware. |
3436 | 605 | for (int i = 0; i < columns; i++) | 605 | for (int i = 0; i < columns; i++) |
3437 | 606 | tabStops[i] = (i%8 == 0 && i != 0); | 606 | tabStops[i] = (i%8 == 0 && i != 0); |
3438 | 607 | } | 607 | } |
3439 | 608 | 608 | ||
3440 | 609 | void Screen::newLine() | 609 | void Screen::newLine() |
3441 | 610 | { | 610 | { |
3443 | 611 | if (getMode(MODE_NewLine)) | 611 | if (getMode(MODE_NewLine)) |
3444 | 612 | toStartOfLine(); | 612 | toStartOfLine(); |
3445 | 613 | index(); | 613 | index(); |
3446 | 614 | } | 614 | } |
3447 | 615 | 615 | ||
3448 | 616 | void Screen::checkSelection(int from, int to) | 616 | void Screen::checkSelection(int from, int to) |
3449 | 617 | { | 617 | { |
3451 | 618 | if (selBegin == -1) | 618 | if (selBegin == -1) |
3452 | 619 | return; | 619 | return; |
3453 | 620 | int scr_TL = loc(0, history->getLines()); | 620 | int scr_TL = loc(0, history->getLines()); |
3454 | 621 | //Clear entire selection if it overlaps region [from, to] | 621 | //Clear entire selection if it overlaps region [from, to] |
3455 | @@ -749,11 +749,11 @@ | |||
3456 | 749 | _scrolledLines += n; | 749 | _scrolledLines += n; |
3457 | 750 | 750 | ||
3458 | 751 | //FIXME: make sure `topMargin', `bottomMargin', `from', `n' is in bounds. | 751 | //FIXME: make sure `topMargin', `bottomMargin', `from', `n' is in bounds. |
3464 | 752 | if (n <= 0) | 752 | if (n <= 0) |
3465 | 753 | return; | 753 | return; |
3466 | 754 | if (from > _bottomMargin) | 754 | if (from > _bottomMargin) |
3467 | 755 | return; | 755 | return; |
3468 | 756 | if (from + n > _bottomMargin) | 756 | if (from + n > _bottomMargin) |
3469 | 757 | n = _bottomMargin - from; | 757 | n = _bottomMargin - from; |
3470 | 758 | moveImage(loc(0,from+n),loc(0,from),loc(columns-1,_bottomMargin-n)); | 758 | moveImage(loc(0,from+n),loc(0,from),loc(columns-1,_bottomMargin-n)); |
3471 | 759 | clearImage(loc(0,from),loc(columns-1,from+n-1),' '); | 759 | clearImage(loc(0,from),loc(columns-1,from+n-1),' '); |
3472 | @@ -800,7 +800,7 @@ | |||
3473 | 800 | } | 800 | } |
3474 | 801 | 801 | ||
3475 | 802 | void Screen::clearImage(int loca, int loce, char c) | 802 | void Screen::clearImage(int loca, int loce, char c) |
3477 | 803 | { | 803 | { |
3478 | 804 | int scr_TL=loc(0,history->getLines()); | 804 | int scr_TL=loc(0,history->getLines()); |
3479 | 805 | //FIXME: check positions | 805 | //FIXME: check positions |
3480 | 806 | 806 | ||
3481 | @@ -851,8 +851,8 @@ | |||
3482 | 851 | int lines=(sourceEnd-sourceBegin)/columns; | 851 | int lines=(sourceEnd-sourceBegin)/columns; |
3483 | 852 | 852 | ||
3484 | 853 | //move screen image and line properties: | 853 | //move screen image and line properties: |
3487 | 854 | //the source and destination areas of the image may overlap, | 854 | //the source and destination areas of the image may overlap, |
3488 | 855 | //so it matters that we do the copy in the right order - | 855 | //so it matters that we do the copy in the right order - |
3489 | 856 | //forwards if dest < sourceBegin or backwards otherwise. | 856 | //forwards if dest < sourceBegin or backwards otherwise. |
3490 | 857 | //(search the web for 'memmove implementation' for details) | 857 | //(search the web for 'memmove implementation' for details) |
3491 | 858 | if (dest < sourceBegin) | 858 | if (dest < sourceBegin) |
3492 | @@ -987,9 +987,9 @@ | |||
3493 | 987 | { | 987 | { |
3494 | 988 | currentForeground = CharacterColor(space, color); | 988 | currentForeground = CharacterColor(space, color); |
3495 | 989 | 989 | ||
3497 | 990 | if ( currentForeground.isValid() ) | 990 | if ( currentForeground.isValid() ) |
3498 | 991 | updateEffectiveRendition(); | 991 | updateEffectiveRendition(); |
3500 | 992 | else | 992 | else |
3501 | 993 | setForeColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR); | 993 | setForeColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR); |
3502 | 994 | } | 994 | } |
3503 | 995 | 995 | ||
3504 | @@ -997,13 +997,13 @@ | |||
3505 | 997 | { | 997 | { |
3506 | 998 | currentBackground = CharacterColor(space, color); | 998 | currentBackground = CharacterColor(space, color); |
3507 | 999 | 999 | ||
3509 | 1000 | if ( currentBackground.isValid() ) | 1000 | if ( currentBackground.isValid() ) |
3510 | 1001 | updateEffectiveRendition(); | 1001 | updateEffectiveRendition(); |
3511 | 1002 | else | 1002 | else |
3512 | 1003 | setBackColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR); | 1003 | setBackColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR); |
3513 | 1004 | } | 1004 | } |
3514 | 1005 | 1005 | ||
3516 | 1006 | void Screen::clearSelection() | 1006 | void Screen::clearSelection() |
3517 | 1007 | { | 1007 | { |
3518 | 1008 | selBottomRight = -1; | 1008 | selBottomRight = -1; |
3519 | 1009 | selTopLeft = -1; | 1009 | selTopLeft = -1; |
3520 | @@ -1015,7 +1015,7 @@ | |||
3521 | 1015 | if ( selTopLeft != -1 ) | 1015 | if ( selTopLeft != -1 ) |
3522 | 1016 | { | 1016 | { |
3523 | 1017 | column = selTopLeft % columns; | 1017 | column = selTopLeft % columns; |
3525 | 1018 | line = selTopLeft / columns; | 1018 | line = selTopLeft / columns; |
3526 | 1019 | } | 1019 | } |
3527 | 1020 | else | 1020 | else |
3528 | 1021 | { | 1021 | { |
3529 | @@ -1034,11 +1034,11 @@ | |||
3530 | 1034 | { | 1034 | { |
3531 | 1035 | column = cuX + getHistLines(); | 1035 | column = cuX + getHistLines(); |
3532 | 1036 | line = cuY + getHistLines(); | 1036 | line = cuY + getHistLines(); |
3534 | 1037 | } | 1037 | } |
3535 | 1038 | } | 1038 | } |
3536 | 1039 | void Screen::setSelectionStart(const int x, const int y, const bool mode) | 1039 | void Screen::setSelectionStart(const int x, const int y, const bool mode) |
3537 | 1040 | { | 1040 | { |
3539 | 1041 | selBegin = loc(x,y); | 1041 | selBegin = loc(x,y); |
3540 | 1042 | /* FIXME, HACK to correct for x too far to the right... */ | 1042 | /* FIXME, HACK to correct for x too far to the right... */ |
3541 | 1043 | if (x == columns) selBegin--; | 1043 | if (x == columns) selBegin--; |
3542 | 1044 | 1044 | ||
3543 | @@ -1049,10 +1049,10 @@ | |||
3544 | 1049 | 1049 | ||
3545 | 1050 | void Screen::setSelectionEnd( const int x, const int y) | 1050 | void Screen::setSelectionEnd( const int x, const int y) |
3546 | 1051 | { | 1051 | { |
3548 | 1052 | if (selBegin == -1) | 1052 | if (selBegin == -1) |
3549 | 1053 | return; | 1053 | return; |
3550 | 1054 | 1054 | ||
3552 | 1055 | int endPos = loc(x,y); | 1055 | int endPos = loc(x,y); |
3553 | 1056 | 1056 | ||
3554 | 1057 | if (endPos < selBegin) | 1057 | if (endPos < selBegin) |
3555 | 1058 | { | 1058 | { |
3556 | @@ -1062,7 +1062,7 @@ | |||
3557 | 1062 | else | 1062 | else |
3558 | 1063 | { | 1063 | { |
3559 | 1064 | /* FIXME, HACK to correct for x too far to the right... */ | 1064 | /* FIXME, HACK to correct for x too far to the right... */ |
3561 | 1065 | if (x == columns) | 1065 | if (x == columns) |
3562 | 1066 | endPos--; | 1066 | endPos--; |
3563 | 1067 | 1067 | ||
3564 | 1068 | selTopLeft = selBegin; | 1068 | selTopLeft = selBegin; |
3565 | @@ -1113,7 +1113,7 @@ | |||
3566 | 1113 | return selTopLeft >= 0 && selBottomRight >= 0; | 1113 | return selTopLeft >= 0 && selBottomRight >= 0; |
3567 | 1114 | } | 1114 | } |
3568 | 1115 | 1115 | ||
3570 | 1116 | void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder , | 1116 | void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder , |
3571 | 1117 | bool preserveLineBreaks) const | 1117 | bool preserveLineBreaks) const |
3572 | 1118 | { | 1118 | { |
3573 | 1119 | if (!isSelectionValid()) | 1119 | if (!isSelectionValid()) |
3574 | @@ -1121,11 +1121,11 @@ | |||
3575 | 1121 | writeToStream(decoder,selTopLeft,selBottomRight,preserveLineBreaks); | 1121 | writeToStream(decoder,selTopLeft,selBottomRight,preserveLineBreaks); |
3576 | 1122 | } | 1122 | } |
3577 | 1123 | 1123 | ||
3579 | 1124 | void Screen::writeToStream(TerminalCharacterDecoder* decoder, | 1124 | void Screen::writeToStream(TerminalCharacterDecoder* decoder, |
3580 | 1125 | int startIndex, int endIndex, | 1125 | int startIndex, int endIndex, |
3581 | 1126 | bool preserveLineBreaks) const | 1126 | bool preserveLineBreaks) const |
3582 | 1127 | { | 1127 | { |
3584 | 1128 | int top = startIndex / columns; | 1128 | int top = startIndex / columns; |
3585 | 1129 | int left = startIndex % columns; | 1129 | int left = startIndex % columns; |
3586 | 1130 | 1130 | ||
3587 | 1131 | int bottom = endIndex / columns; | 1131 | int bottom = endIndex / columns; |
3588 | @@ -1145,7 +1145,7 @@ | |||
3589 | 1145 | int copied = copyLineToStream( y, | 1145 | int copied = copyLineToStream( y, |
3590 | 1146 | start, | 1146 | start, |
3591 | 1147 | count, | 1147 | count, |
3593 | 1148 | decoder, | 1148 | decoder, |
3594 | 1149 | appendNewLine, | 1149 | appendNewLine, |
3595 | 1150 | preserveLineBreaks ); | 1150 | preserveLineBreaks ); |
3596 | 1151 | 1151 | ||
3597 | @@ -1153,25 +1153,25 @@ | |||
3598 | 1153 | // append a new line character. | 1153 | // append a new line character. |
3599 | 1154 | // | 1154 | // |
3600 | 1155 | // this makes it possible to 'select' a trailing new line character after | 1155 | // this makes it possible to 'select' a trailing new line character after |
3603 | 1156 | // the text on a line. | 1156 | // the text on a line. |
3604 | 1157 | if ( y == bottom && | 1157 | if ( y == bottom && |
3605 | 1158 | copied < count ) | 1158 | copied < count ) |
3606 | 1159 | { | 1159 | { |
3607 | 1160 | Character newLineChar('\n'); | 1160 | Character newLineChar('\n'); |
3608 | 1161 | decoder->decodeLine(&newLineChar,1,0); | 1161 | decoder->decodeLine(&newLineChar,1,0); |
3609 | 1162 | } | 1162 | } |
3611 | 1163 | } | 1163 | } |
3612 | 1164 | } | 1164 | } |
3613 | 1165 | 1165 | ||
3616 | 1166 | int Screen::copyLineToStream(int line , | 1166 | int Screen::copyLineToStream(int line , |
3617 | 1167 | int start, | 1167 | int start, |
3618 | 1168 | int count, | 1168 | int count, |
3619 | 1169 | TerminalCharacterDecoder* decoder, | 1169 | TerminalCharacterDecoder* decoder, |
3620 | 1170 | bool appendNewLine, | 1170 | bool appendNewLine, |
3621 | 1171 | bool preserveLineBreaks) const | 1171 | bool preserveLineBreaks) const |
3622 | 1172 | { | 1172 | { |
3623 | 1173 | //buffer to hold characters for decoding | 1173 | //buffer to hold characters for decoding |
3625 | 1174 | //the buffer is static to avoid initialising every | 1174 | //the buffer is static to avoid initialising every |
3626 | 1175 | //element on each call to copyLineToStream | 1175 | //element on each call to copyLineToStream |
3627 | 1176 | //(which is unnecessary since all elements will be overwritten anyway) | 1176 | //(which is unnecessary since all elements will be overwritten anyway) |
3628 | 1177 | static const int MAX_CHARS = 1024; | 1177 | static const int MAX_CHARS = 1024; |
3629 | @@ -1191,7 +1191,7 @@ | |||
3630 | 1191 | 1191 | ||
3631 | 1192 | // retrieve line from history buffer. It is assumed | 1192 | // retrieve line from history buffer. It is assumed |
3632 | 1193 | // that the history buffer does not store trailing white space | 1193 | // that the history buffer does not store trailing white space |
3634 | 1194 | // at the end of the line, so it does not need to be trimmed here | 1194 | // at the end of the line, so it does not need to be trimmed here |
3635 | 1195 | if (count == -1) | 1195 | if (count == -1) |
3636 | 1196 | { | 1196 | { |
3637 | 1197 | count = lineLength-start; | 1197 | count = lineLength-start; |
3638 | @@ -1203,7 +1203,7 @@ | |||
3639 | 1203 | 1203 | ||
3640 | 1204 | // safety checks | 1204 | // safety checks |
3641 | 1205 | assert( start >= 0 ); | 1205 | assert( start >= 0 ); |
3643 | 1206 | assert( count >= 0 ); | 1206 | assert( count >= 0 ); |
3644 | 1207 | assert( (start+count) <= history->getLineLen(line) ); | 1207 | assert( (start+count) <= history->getLineLen(line) ); |
3645 | 1208 | 1208 | ||
3646 | 1209 | history->getCells(line,start,count,characterBuffer); | 1209 | history->getCells(line,start,count,characterBuffer); |
3647 | @@ -1233,7 +1233,7 @@ | |||
3648 | 1233 | count = qBound(0,count,length-start); | 1233 | count = qBound(0,count,length-start); |
3649 | 1234 | 1234 | ||
3650 | 1235 | Q_ASSERT( screenLine < lineProperties.count() ); | 1235 | Q_ASSERT( screenLine < lineProperties.count() ); |
3652 | 1236 | currentLineProperties |= lineProperties[screenLine]; | 1236 | currentLineProperties |= lineProperties[screenLine]; |
3653 | 1237 | } | 1237 | } |
3654 | 1238 | 1238 | ||
3655 | 1239 | // add new line character at end | 1239 | // add new line character at end |
3656 | @@ -1246,8 +1246,8 @@ | |||
3657 | 1246 | count++; | 1246 | count++; |
3658 | 1247 | } | 1247 | } |
3659 | 1248 | 1248 | ||
3662 | 1249 | //decode line and write to text stream | 1249 | //decode line and write to text stream |
3663 | 1250 | decoder->decodeLine( (Character*) characterBuffer , | 1250 | decoder->decodeLine( (Character*) characterBuffer , |
3664 | 1251 | count, currentLineProperties ); | 1251 | count, currentLineProperties ); |
3665 | 1252 | 1252 | ||
3666 | 1253 | return count; | 1253 | return count; |
3667 | 1254 | 1254 | ||
3668 | === modified file 'src/plugin/konsole/Screen.h' | |||
3669 | --- src/plugin/konsole/Screen.h 2014-04-27 09:11:14 +0000 | |||
3670 | +++ src/plugin/konsole/Screen.h 2014-07-30 09:50:10 +0000 | |||
3671 | @@ -50,21 +50,21 @@ | |||
3672 | 50 | characters from the program currently running in the terminal. | 50 | characters from the program currently running in the terminal. |
3673 | 51 | From this stream it creates an image of characters which is ultimately | 51 | From this stream it creates an image of characters which is ultimately |
3674 | 52 | rendered by the display widget ( TerminalDisplay ). Some types of emulation | 52 | rendered by the display widget ( TerminalDisplay ). Some types of emulation |
3676 | 53 | may have more than one screen image. | 53 | may have more than one screen image. |
3677 | 54 | 54 | ||
3678 | 55 | getImage() is used to retrieve the currently visible image | 55 | getImage() is used to retrieve the currently visible image |
3679 | 56 | which is then used by the display widget to draw the output from the | 56 | which is then used by the display widget to draw the output from the |
3681 | 57 | terminal. | 57 | terminal. |
3682 | 58 | 58 | ||
3683 | 59 | The number of lines of output history which are kept in addition to the current | 59 | The number of lines of output history which are kept in addition to the current |
3685 | 60 | screen image depends on the history scroll being used to store the output. | 60 | screen image depends on the history scroll being used to store the output. |
3686 | 61 | The scroll is specified using setScroll() | 61 | The scroll is specified using setScroll() |
3687 | 62 | The output history can be retrieved using writeToStream() | 62 | The output history can be retrieved using writeToStream() |
3688 | 63 | 63 | ||
3690 | 64 | The screen image has a selection associated with it, specified using | 64 | The screen image has a selection associated with it, specified using |
3691 | 65 | setSelectionStart() and setSelectionEnd(). The selected text can be retrieved | 65 | setSelectionStart() and setSelectionEnd(). The selected text can be retrieved |
3692 | 66 | using selectedText(). When getImage() is used to retrieve the visible image, | 66 | using selectedText(). When getImage() is used to retrieve the visible image, |
3694 | 67 | characters which are part of the selection have their colours inverted. | 67 | characters which are part of the selection have their colours inverted. |
3695 | 68 | */ | 68 | */ |
3696 | 69 | class Screen | 69 | class Screen |
3697 | 70 | { | 70 | { |
3698 | @@ -73,25 +73,25 @@ | |||
3699 | 73 | Screen(int lines, int columns); | 73 | Screen(int lines, int columns); |
3700 | 74 | ~Screen(); | 74 | ~Screen(); |
3701 | 75 | 75 | ||
3703 | 76 | // VT100/2 Operations | 76 | // VT100/2 Operations |
3704 | 77 | // Cursor Movement | 77 | // Cursor Movement |
3708 | 78 | 78 | ||
3709 | 79 | /** | 79 | /** |
3710 | 80 | * Move the cursor up by @p n lines. The cursor will stop at the | 80 | * Move the cursor up by @p n lines. The cursor will stop at the |
3711 | 81 | * top margin. | 81 | * top margin. |
3712 | 82 | */ | 82 | */ |
3713 | 83 | void cursorUp(int n); | 83 | void cursorUp(int n); |
3715 | 84 | /** | 84 | /** |
3716 | 85 | * Move the cursor down by @p n lines. The cursor will stop at the | 85 | * Move the cursor down by @p n lines. The cursor will stop at the |
3717 | 86 | * bottom margin. | 86 | * bottom margin. |
3718 | 87 | */ | 87 | */ |
3719 | 88 | void cursorDown(int n); | 88 | void cursorDown(int n); |
3721 | 89 | /** | 89 | /** |
3722 | 90 | * Move the cursor to the left by @p n columns. | 90 | * Move the cursor to the left by @p n columns. |
3723 | 91 | * The cursor will stop at the first column. | 91 | * The cursor will stop at the first column. |
3724 | 92 | */ | 92 | */ |
3725 | 93 | void cursorLeft(int n); | 93 | void cursorLeft(int n); |
3727 | 94 | /** | 94 | /** |
3728 | 95 | * Move the cursor to the right by @p n columns. | 95 | * Move the cursor to the right by @p n columns. |
3729 | 96 | * The cursor will stop at the right-most column. | 96 | * The cursor will stop at the right-most column. |
3730 | 97 | */ | 97 | */ |
3731 | @@ -105,28 +105,28 @@ | |||
3732 | 105 | /** | 105 | /** |
3733 | 106 | * Sets the margins for scrolling the screen. | 106 | * Sets the margins for scrolling the screen. |
3734 | 107 | * | 107 | * |
3737 | 108 | * @param topLine The top line of the new scrolling margin. | 108 | * @param topLine The top line of the new scrolling margin. |
3738 | 109 | * @param bottomLine The bottom line of the new scrolling margin. | 109 | * @param bottomLine The bottom line of the new scrolling margin. |
3739 | 110 | */ | 110 | */ |
3740 | 111 | void setMargins(int topLine , int bottomLine); | 111 | void setMargins(int topLine , int bottomLine); |
3742 | 112 | /** Returns the top line of the scrolling region. */ | 112 | /** Returns the top line of the scrolling region. */ |
3743 | 113 | int topMargin() const; | 113 | int topMargin() const; |
3744 | 114 | /** Returns the bottom line of the scrolling region. */ | 114 | /** Returns the bottom line of the scrolling region. */ |
3745 | 115 | int bottomMargin() const; | 115 | int bottomMargin() const; |
3746 | 116 | 116 | ||
3748 | 117 | /** | 117 | /** |
3749 | 118 | * Resets the scrolling margins back to the top and bottom lines | 118 | * Resets the scrolling margins back to the top and bottom lines |
3750 | 119 | * of the screen. | 119 | * of the screen. |
3751 | 120 | */ | 120 | */ |
3752 | 121 | void setDefaultMargins(); | 121 | void setDefaultMargins(); |
3756 | 122 | 122 | ||
3757 | 123 | /** | 123 | /** |
3758 | 124 | * Moves the cursor down one line, if the MODE_NewLine mode | 124 | * Moves the cursor down one line, if the MODE_NewLine mode |
3759 | 125 | * flag is enabled then the cursor is returned to the leftmost | 125 | * flag is enabled then the cursor is returned to the leftmost |
3760 | 126 | * column first. | 126 | * column first. |
3761 | 127 | * | 127 | * |
3762 | 128 | * Equivalent to NextLine() if the MODE_NewLine flag is set | 128 | * Equivalent to NextLine() if the MODE_NewLine flag is set |
3764 | 129 | * or index() otherwise. | 129 | * or index() otherwise. |
3765 | 130 | */ | 130 | */ |
3766 | 131 | void newLine(); | 131 | void newLine(); |
3767 | 132 | /** | 132 | /** |
3768 | @@ -135,7 +135,7 @@ | |||
3769 | 135 | */ | 135 | */ |
3770 | 136 | void nextLine(); | 136 | void nextLine(); |
3771 | 137 | 137 | ||
3773 | 138 | /** | 138 | /** |
3774 | 139 | * Move the cursor down one line. If the cursor is on the bottom | 139 | * Move the cursor down one line. If the cursor is on the bottom |
3775 | 140 | * line of the scrolling region (as returned by bottomMargin()) the | 140 | * line of the scrolling region (as returned by bottomMargin()) the |
3776 | 141 | * scrolling region is scrolled up by one line instead. | 141 | * scrolling region is scrolled up by one line instead. |
3777 | @@ -147,12 +147,12 @@ | |||
3778 | 147 | * region is scrolled down by one line instead. | 147 | * region is scrolled down by one line instead. |
3779 | 148 | */ | 148 | */ |
3780 | 149 | void reverseIndex(); | 149 | void reverseIndex(); |
3785 | 150 | 150 | ||
3786 | 151 | /** | 151 | /** |
3787 | 152 | * Scroll the scrolling region of the screen up by @p n lines. | 152 | * Scroll the scrolling region of the screen up by @p n lines. |
3788 | 153 | * The scrolling region is initially the whole screen, but can be changed | 153 | * The scrolling region is initially the whole screen, but can be changed |
3789 | 154 | * using setMargins() | 154 | * using setMargins() |
3791 | 155 | */ | 155 | */ |
3792 | 156 | void scrollUp(int n); | 156 | void scrollUp(int n); |
3793 | 157 | /** | 157 | /** |
3794 | 158 | * Scroll the scrolling region of the screen down by @p n lines. | 158 | * Scroll the scrolling region of the screen down by @p n lines. |
3795 | @@ -160,12 +160,12 @@ | |||
3796 | 160 | * using setMargins() | 160 | * using setMargins() |
3797 | 161 | */ | 161 | */ |
3798 | 162 | void scrollDown(int n); | 162 | void scrollDown(int n); |
3801 | 163 | /** | 163 | /** |
3802 | 164 | * Moves the cursor to the beginning of the current line. | 164 | * Moves the cursor to the beginning of the current line. |
3803 | 165 | * Equivalent to setCursorX(0) | 165 | * Equivalent to setCursorX(0) |
3804 | 166 | */ | 166 | */ |
3805 | 167 | void toStartOfLine(); | 167 | void toStartOfLine(); |
3807 | 168 | /** | 168 | /** |
3808 | 169 | * Moves the cursor one column to the left and erases the character | 169 | * Moves the cursor one column to the left and erases the character |
3809 | 170 | * at the new cursor position. | 170 | * at the new cursor position. |
3810 | 171 | */ | 171 | */ |
3811 | @@ -174,28 +174,28 @@ | |||
3812 | 174 | void tab(int n = 1); | 174 | void tab(int n = 1); |
3813 | 175 | /** Moves the cursor @p n tab-stops to the left. */ | 175 | /** Moves the cursor @p n tab-stops to the left. */ |
3814 | 176 | void backtab(int n); | 176 | void backtab(int n); |
3816 | 177 | 177 | ||
3817 | 178 | // Editing | 178 | // Editing |
3821 | 179 | 179 | ||
3822 | 180 | /** | 180 | /** |
3823 | 181 | * Erase @p n characters beginning from the current cursor position. | 181 | * Erase @p n characters beginning from the current cursor position. |
3824 | 182 | * This is equivalent to over-writing @p n characters starting with the current | 182 | * This is equivalent to over-writing @p n characters starting with the current |
3825 | 183 | * cursor position with spaces. | 183 | * cursor position with spaces. |
3827 | 184 | * If @p n is 0 then one character is erased. | 184 | * If @p n is 0 then one character is erased. |
3828 | 185 | */ | 185 | */ |
3829 | 186 | void eraseChars(int n); | 186 | void eraseChars(int n); |
3833 | 187 | /** | 187 | /** |
3834 | 188 | * Delete @p n characters beginning from the current cursor position. | 188 | * Delete @p n characters beginning from the current cursor position. |
3835 | 189 | * If @p n is 0 then one character is deleted. | 189 | * If @p n is 0 then one character is deleted. |
3836 | 190 | */ | 190 | */ |
3837 | 191 | void deleteChars(int n); | 191 | void deleteChars(int n); |
3838 | 192 | /** | 192 | /** |
3839 | 193 | * Insert @p n blank characters beginning from the current cursor position. | 193 | * Insert @p n blank characters beginning from the current cursor position. |
3841 | 194 | * The position of the cursor is not altered. | 194 | * The position of the cursor is not altered. |
3842 | 195 | * If @p n is 0 then one character is inserted. | 195 | * If @p n is 0 then one character is inserted. |
3843 | 196 | */ | 196 | */ |
3844 | 197 | void insertChars(int n); | 197 | void insertChars(int n); |
3846 | 198 | /** | 198 | /** |
3847 | 199 | * Removes @p n lines beginning from the current cursor position. | 199 | * Removes @p n lines beginning from the current cursor position. |
3848 | 200 | * The position of the cursor is not altered. | 200 | * The position of the cursor is not altered. |
3849 | 201 | * If @p n is 0 then one line is removed. | 201 | * If @p n is 0 then one line is removed. |
3850 | @@ -209,14 +209,14 @@ | |||
3851 | 209 | void insertLines(int n); | 209 | void insertLines(int n); |
3852 | 210 | /** Clears all the tab stops. */ | 210 | /** Clears all the tab stops. */ |
3853 | 211 | void clearTabStops(); | 211 | void clearTabStops(); |
3855 | 212 | /** Sets or removes a tab stop at the cursor's current column. */ | 212 | /** Sets or removes a tab stop at the cursor's current column. */ |
3856 | 213 | void changeTabStop(bool set); | 213 | void changeTabStop(bool set); |
3858 | 214 | 214 | ||
3859 | 215 | /** Resets (clears) the specified screen @p mode. */ | 215 | /** Resets (clears) the specified screen @p mode. */ |
3860 | 216 | void resetMode(int mode); | 216 | void resetMode(int mode); |
3861 | 217 | /** Sets (enables) the specified screen @p mode. */ | 217 | /** Sets (enables) the specified screen @p mode. */ |
3862 | 218 | void setMode(int mode); | 218 | void setMode(int mode); |
3864 | 219 | /** | 219 | /** |
3865 | 220 | * Saves the state of the specified screen @p mode. It can be restored | 220 | * Saves the state of the specified screen @p mode. It can be restored |
3866 | 221 | * using restoreMode() | 221 | * using restoreMode() |
3867 | 222 | */ | 222 | */ |
3868 | @@ -225,19 +225,19 @@ | |||
3869 | 225 | void restoreMode(int mode); | 225 | void restoreMode(int mode); |
3870 | 226 | /** Returns whether the specified screen @p mode is enabled or not .*/ | 226 | /** Returns whether the specified screen @p mode is enabled or not .*/ |
3871 | 227 | bool getMode(int mode) const; | 227 | bool getMode(int mode) const; |
3877 | 228 | 228 | ||
3878 | 229 | /** | 229 | /** |
3879 | 230 | * Saves the current position and appearance (text color and style) of the cursor. | 230 | * Saves the current position and appearance (text color and style) of the cursor. |
3880 | 231 | * It can be restored by calling restoreCursor() | 231 | * It can be restored by calling restoreCursor() |
3881 | 232 | */ | 232 | */ |
3882 | 233 | void saveCursor(); | 233 | void saveCursor(); |
3883 | 234 | /** Restores the position and appearance of the cursor. See saveCursor() */ | 234 | /** Restores the position and appearance of the cursor. See saveCursor() */ |
3884 | 235 | void restoreCursor(); | 235 | void restoreCursor(); |
3887 | 236 | 236 | ||
3888 | 237 | /** Clear the whole screen, moving the current screen contents into the history first. */ | 237 | /** Clear the whole screen, moving the current screen contents into the history first. */ |
3889 | 238 | void clearEntireScreen(); | 238 | void clearEntireScreen(); |
3892 | 239 | /** | 239 | /** |
3893 | 240 | * Clear the area of the screen from the current cursor position to the end of | 240 | * Clear the area of the screen from the current cursor position to the end of |
3894 | 241 | * the screen. | 241 | * the screen. |
3895 | 242 | */ | 242 | */ |
3896 | 243 | void clearToEndOfScreen(); | 243 | void clearToEndOfScreen(); |
3897 | @@ -252,16 +252,16 @@ | |||
3898 | 252 | void clearToEndOfLine(); | 252 | void clearToEndOfLine(); |
3899 | 253 | /** Clears from the current cursor position to the beginning of the line. */ | 253 | /** Clears from the current cursor position to the beginning of the line. */ |
3900 | 254 | void clearToBeginOfLine(); | 254 | void clearToBeginOfLine(); |
3902 | 255 | 255 | ||
3903 | 256 | /** Fills the entire screen with the letter 'E' */ | 256 | /** Fills the entire screen with the letter 'E' */ |
3904 | 257 | void helpAlign(); | 257 | void helpAlign(); |
3908 | 258 | 258 | ||
3909 | 259 | /** | 259 | /** |
3910 | 260 | * Enables the given @p rendition flag. Rendition flags control the appearance | 260 | * Enables the given @p rendition flag. Rendition flags control the appearance |
3911 | 261 | * of characters on the screen. | 261 | * of characters on the screen. |
3912 | 262 | * | 262 | * |
3913 | 263 | * @see Character::rendition | 263 | * @see Character::rendition |
3915 | 264 | */ | 264 | */ |
3916 | 265 | void setRendition(int rendition); | 265 | void setRendition(int rendition); |
3917 | 266 | /** | 266 | /** |
3918 | 267 | * Disables the given @p rendition flag. Rendition flags control the appearance | 267 | * Disables the given @p rendition flag. Rendition flags control the appearance |
3919 | @@ -270,8 +270,8 @@ | |||
3920 | 270 | * @see Character::rendition | 270 | * @see Character::rendition |
3921 | 271 | */ | 271 | */ |
3922 | 272 | void resetRendition(int rendition); | 272 | void resetRendition(int rendition); |
3925 | 273 | 273 | ||
3926 | 274 | /** | 274 | /** |
3927 | 275 | * Sets the cursor's foreground color. | 275 | * Sets the cursor's foreground color. |
3928 | 276 | * @param space The color space used by the @p color argument | 276 | * @param space The color space used by the @p color argument |
3929 | 277 | * @param color The new foreground color. The meaning of this depends on | 277 | * @param color The new foreground color. The meaning of this depends on |
3930 | @@ -289,24 +289,24 @@ | |||
3931 | 289 | * @see CharacterColor | 289 | * @see CharacterColor |
3932 | 290 | */ | 290 | */ |
3933 | 291 | void setBackColor(int space, int color); | 291 | void setBackColor(int space, int color); |
3936 | 292 | /** | 292 | /** |
3937 | 293 | * Resets the cursor's color back to the default and sets the | 293 | * Resets the cursor's color back to the default and sets the |
3938 | 294 | * character's rendition flags back to the default settings. | 294 | * character's rendition flags back to the default settings. |
3939 | 295 | */ | 295 | */ |
3940 | 296 | void setDefaultRendition(); | 296 | void setDefaultRendition(); |
3942 | 297 | 297 | ||
3943 | 298 | /** Returns the column which the cursor is positioned at. */ | 298 | /** Returns the column which the cursor is positioned at. */ |
3944 | 299 | int getCursorX() const; | 299 | int getCursorX() const; |
3945 | 300 | /** Returns the line which the cursor is positioned on. */ | 300 | /** Returns the line which the cursor is positioned on. */ |
3946 | 301 | int getCursorY() const; | 301 | int getCursorY() const; |
3948 | 302 | 302 | ||
3949 | 303 | /** Clear the entire screen and move the cursor to the home position. | 303 | /** Clear the entire screen and move the cursor to the home position. |
3950 | 304 | * Equivalent to calling clearEntireScreen() followed by home(). | 304 | * Equivalent to calling clearEntireScreen() followed by home(). |
3951 | 305 | */ | 305 | */ |
3952 | 306 | void clear(); | 306 | void clear(); |
3954 | 307 | /** | 307 | /** |
3955 | 308 | * Sets the position of the cursor to the 'home' position at the top-left | 308 | * Sets the position of the cursor to the 'home' position at the top-left |
3957 | 309 | * corner of the screen (0,0) | 309 | * corner of the screen (0,0) |
3958 | 310 | */ | 310 | */ |
3959 | 311 | void home(); | 311 | void home(); |
3960 | 312 | /** | 312 | /** |
3961 | @@ -323,41 +323,41 @@ | |||
3962 | 323 | * <li>New line mode is disabled. TODO Document me</li> | 323 | * <li>New line mode is disabled. TODO Document me</li> |
3963 | 324 | * </ul> | 324 | * </ul> |
3964 | 325 | * | 325 | * |
3966 | 326 | * If @p clearScreen is true then the screen contents are erased entirely, | 326 | * If @p clearScreen is true then the screen contents are erased entirely, |
3967 | 327 | * otherwise they are unaltered. | 327 | * otherwise they are unaltered. |
3968 | 328 | */ | 328 | */ |
3969 | 329 | void reset(bool clearScreen = true); | 329 | void reset(bool clearScreen = true); |
3974 | 330 | 330 | ||
3975 | 331 | /** | 331 | /** |
3976 | 332 | * Displays a new character at the current cursor position. | 332 | * Displays a new character at the current cursor position. |
3977 | 333 | * | 333 | * |
3978 | 334 | * If the cursor is currently positioned at the right-edge of the screen and | 334 | * If the cursor is currently positioned at the right-edge of the screen and |
3980 | 335 | * line wrapping is enabled then the character is added at the start of a new | 335 | * line wrapping is enabled then the character is added at the start of a new |
3981 | 336 | * line below the current one. | 336 | * line below the current one. |
3982 | 337 | * | 337 | * |
3987 | 338 | * If the MODE_Insert screen mode is currently enabled then the character | 338 | * If the MODE_Insert screen mode is currently enabled then the character |
3988 | 339 | * is inserted at the current cursor position, otherwise it will replace the | 339 | * is inserted at the current cursor position, otherwise it will replace the |
3989 | 340 | * character already at the current cursor position. | 340 | * character already at the current cursor position. |
3990 | 341 | */ | 341 | */ |
3991 | 342 | void displayCharacter(unsigned short c); | 342 | void displayCharacter(unsigned short c); |
3993 | 343 | 343 | ||
3994 | 344 | // Do composition with last shown character FIXME: Not implemented yet for KDE 4 | 344 | // Do composition with last shown character FIXME: Not implemented yet for KDE 4 |
3995 | 345 | void compose(const QString& compose); | 345 | void compose(const QString& compose); |
3999 | 346 | 346 | ||
4000 | 347 | /** | 347 | /** |
4001 | 348 | * Resizes the image to a new fixed size of @p new_lines by @p new_columns. | 348 | * Resizes the image to a new fixed size of @p new_lines by @p new_columns. |
4002 | 349 | * In the case that @p new_columns is smaller than the current number of columns, | 349 | * In the case that @p new_columns is smaller than the current number of columns, |
4003 | 350 | * existing lines are not truncated. This prevents characters from being lost | 350 | * existing lines are not truncated. This prevents characters from being lost |
4004 | 351 | * if the terminal display is resized smaller and then larger again. | 351 | * if the terminal display is resized smaller and then larger again. |
4005 | 352 | * | 352 | * |
4007 | 353 | * The top and bottom margins are reset to the top and bottom of the new | 353 | * The top and bottom margins are reset to the top and bottom of the new |
4008 | 354 | * screen size. Tab stops are also reset and the current selection is | 354 | * screen size. Tab stops are also reset and the current selection is |
4009 | 355 | * cleared. | 355 | * cleared. |
4010 | 356 | */ | 356 | */ |
4011 | 357 | void resizeImage(int new_lines, int new_columns); | 357 | void resizeImage(int new_lines, int new_columns); |
4013 | 358 | 358 | ||
4014 | 359 | /** | 359 | /** |
4016 | 360 | * Returns the current screen image. | 360 | * Returns the current screen image. |
4017 | 361 | * The result is an array of Characters of size [getLines()][getColumns()] which | 361 | * The result is an array of Characters of size [getLines()][getColumns()] which |
4018 | 362 | * must be freed by the caller after use. | 362 | * must be freed by the caller after use. |
4019 | 363 | * | 363 | * |
4020 | @@ -368,38 +368,38 @@ | |||
4021 | 368 | */ | 368 | */ |
4022 | 369 | void getImage( Character* dest , int size , int startLine , int endLine ) const; | 369 | void getImage( Character* dest , int size , int startLine , int endLine ) const; |
4023 | 370 | 370 | ||
4025 | 371 | /** | 371 | /** |
4026 | 372 | * Returns the additional attributes associated with lines in the image. | 372 | * Returns the additional attributes associated with lines in the image. |
4028 | 373 | * The most important attribute is LINE_WRAPPED which specifies that the | 373 | * The most important attribute is LINE_WRAPPED which specifies that the |
4029 | 374 | * line is wrapped, | 374 | * line is wrapped, |
4030 | 375 | * other attributes control the size of characters in the line. | 375 | * other attributes control the size of characters in the line. |
4031 | 376 | */ | 376 | */ |
4032 | 377 | QVector<LineProperty> getLineProperties( int startLine , int endLine ) const; | 377 | QVector<LineProperty> getLineProperties( int startLine , int endLine ) const; |
4034 | 378 | 378 | ||
4035 | 379 | 379 | ||
4036 | 380 | /** Return the number of lines. */ | 380 | /** Return the number of lines. */ |
4038 | 381 | int getLines() const | 381 | int getLines() const |
4039 | 382 | { return lines; } | 382 | { return lines; } |
4040 | 383 | /** Return the number of columns. */ | 383 | /** Return the number of columns. */ |
4042 | 384 | int getColumns() const | 384 | int getColumns() const |
4043 | 385 | { return columns; } | 385 | { return columns; } |
4044 | 386 | /** Return the number of lines in the history buffer. */ | 386 | /** Return the number of lines in the history buffer. */ |
4045 | 387 | int getHistLines() const; | 387 | int getHistLines() const; |
4049 | 388 | /** | 388 | /** |
4050 | 389 | * Sets the type of storage used to keep lines in the history. | 389 | * Sets the type of storage used to keep lines in the history. |
4051 | 390 | * If @p copyPreviousScroll is true then the contents of the previous | 390 | * If @p copyPreviousScroll is true then the contents of the previous |
4052 | 391 | * history buffer are copied into the new scroll. | 391 | * history buffer are copied into the new scroll. |
4053 | 392 | */ | 392 | */ |
4054 | 393 | void setScroll(const HistoryType& , bool copyPreviousScroll = true); | 393 | void setScroll(const HistoryType& , bool copyPreviousScroll = true); |
4055 | 394 | /** Returns the type of storage used to keep lines in the history. */ | 394 | /** Returns the type of storage used to keep lines in the history. */ |
4056 | 395 | const HistoryType& getScroll() const; | 395 | const HistoryType& getScroll() const; |
4058 | 396 | /** | 396 | /** |
4059 | 397 | * Returns true if this screen keeps lines that are scrolled off the screen | 397 | * Returns true if this screen keeps lines that are scrolled off the screen |
4060 | 398 | * in a history buffer. | 398 | * in a history buffer. |
4061 | 399 | */ | 399 | */ |
4062 | 400 | bool hasScroll() const; | 400 | bool hasScroll() const; |
4063 | 401 | 401 | ||
4065 | 402 | /** | 402 | /** |
4066 | 403 | * Sets the start of the selection. | 403 | * Sets the start of the selection. |
4067 | 404 | * | 404 | * |
4068 | 405 | * @param column The column index of the first character in the selection. | 405 | * @param column The column index of the first character in the selection. |
4069 | @@ -407,21 +407,21 @@ | |||
4070 | 407 | * @param blockSelectionMode True if the selection is in column mode. | 407 | * @param blockSelectionMode True if the selection is in column mode. |
4071 | 408 | */ | 408 | */ |
4072 | 409 | void setSelectionStart(const int column, const int line, const bool blockSelectionMode); | 409 | void setSelectionStart(const int column, const int line, const bool blockSelectionMode); |
4074 | 410 | 410 | ||
4075 | 411 | /** | 411 | /** |
4076 | 412 | * Sets the end of the current selection. | 412 | * Sets the end of the current selection. |
4077 | 413 | * | 413 | * |
4078 | 414 | * @param column The column index of the last character in the selection. | 414 | * @param column The column index of the last character in the selection. |
4081 | 415 | * @param line The line index of the last character in the selection. | 415 | * @param line The line index of the last character in the selection. |
4082 | 416 | */ | 416 | */ |
4083 | 417 | void setSelectionEnd(const int column, const int line); | 417 | void setSelectionEnd(const int column, const int line); |
4085 | 418 | 418 | ||
4086 | 419 | /** | 419 | /** |
4087 | 420 | * Retrieves the start of the selection or the cursor position if there | 420 | * Retrieves the start of the selection or the cursor position if there |
4088 | 421 | * is no selection. | 421 | * is no selection. |
4089 | 422 | */ | 422 | */ |
4090 | 423 | void getSelectionStart(int& column , int& line) const; | 423 | void getSelectionStart(int& column , int& line) const; |
4092 | 424 | 424 | ||
4093 | 425 | /** | 425 | /** |
4094 | 426 | * Retrieves the end of the selection or the cursor position if there | 426 | * Retrieves the end of the selection or the cursor position if there |
4095 | 427 | * is no selection. | 427 | * is no selection. |
4096 | @@ -431,19 +431,19 @@ | |||
4097 | 431 | /** Clears the current selection */ | 431 | /** Clears the current selection */ |
4098 | 432 | void clearSelection(); | 432 | void clearSelection(); |
4099 | 433 | 433 | ||
4101 | 434 | /** | 434 | /** |
4102 | 435 | * Returns true if the character at (@p column, @p line) is part of the | 435 | * Returns true if the character at (@p column, @p line) is part of the |
4105 | 436 | * current selection. | 436 | * current selection. |
4106 | 437 | */ | 437 | */ |
4107 | 438 | bool isSelected(const int column,const int line) const; | 438 | bool isSelected(const int column,const int line) const; |
4108 | 439 | 439 | ||
4112 | 440 | /** | 440 | /** |
4113 | 441 | * Convenience method. Returns the currently selected text. | 441 | * Convenience method. Returns the currently selected text. |
4114 | 442 | * @param preserveLineBreaks Specifies whether new line characters should | 442 | * @param preserveLineBreaks Specifies whether new line characters should |
4115 | 443 | * be inserted into the returned text at the end of each terminal line. | 443 | * be inserted into the returned text at the end of each terminal line. |
4116 | 444 | */ | 444 | */ |
4117 | 445 | QString selectedText(bool preserveLineBreaks) const; | 445 | QString selectedText(bool preserveLineBreaks) const; |
4119 | 446 | 446 | ||
4120 | 447 | /** | 447 | /** |
4121 | 448 | * Copies part of the output to a stream. | 448 | * Copies part of the output to a stream. |
4122 | 449 | * | 449 | * |
4123 | @@ -457,11 +457,11 @@ | |||
4124 | 457 | * Copies the selected characters, set using @see setSelBeginXY and @see setSelExtentXY | 457 | * Copies the selected characters, set using @see setSelBeginXY and @see setSelExtentXY |
4125 | 458 | * into a stream. | 458 | * into a stream. |
4126 | 459 | * | 459 | * |
4129 | 460 | * @param decoder A decoder which converts terminal characters into text. | 460 | * @param decoder A decoder which converts terminal characters into text. |
4130 | 461 | * PlainTextDecoder is the most commonly used decoder which converts characters | 461 | * PlainTextDecoder is the most commonly used decoder which converts characters |
4131 | 462 | * into plain text with no formatting. | 462 | * into plain text with no formatting. |
4134 | 463 | * @param preserveLineBreaks Specifies whether new line characters should | 463 | * @param preserveLineBreaks Specifies whether new line characters should |
4135 | 464 | * be inserted into the returned text at the end of each terminal line. | 464 | * be inserted into the returned text at the end of each terminal line. |
4136 | 465 | */ | 465 | */ |
4137 | 466 | void writeSelectionToStream(TerminalCharacterDecoder* decoder , bool | 466 | void writeSelectionToStream(TerminalCharacterDecoder* decoder , bool |
4138 | 467 | preserveLineBreaks = true) const; | 467 | preserveLineBreaks = true) const; |
4139 | @@ -478,15 +478,15 @@ | |||
4140 | 478 | */ | 478 | */ |
4141 | 479 | void checkSelection(int from, int to); | 479 | void checkSelection(int from, int to); |
4142 | 480 | 480 | ||
4144 | 481 | /** | 481 | /** |
4145 | 482 | * Sets or clears an attribute of the current line. | 482 | * Sets or clears an attribute of the current line. |
4147 | 483 | * | 483 | * |
4148 | 484 | * @param property The attribute to set or clear | 484 | * @param property The attribute to set or clear |
4149 | 485 | * Possible properties are: | 485 | * Possible properties are: |
4150 | 486 | * LINE_WRAPPED: Specifies that the line is wrapped. | 486 | * LINE_WRAPPED: Specifies that the line is wrapped. |
4151 | 487 | * LINE_DOUBLEWIDTH: Specifies that the characters in the current line | 487 | * LINE_DOUBLEWIDTH: Specifies that the characters in the current line |
4152 | 488 | * should be double the normal width. | 488 | * should be double the normal width. |
4154 | 489 | * LINE_DOUBLEHEIGHT:Specifies that the characters in the current line | 489 | * LINE_DOUBLEHEIGHT:Specifies that the characters in the current line |
4155 | 490 | * should be double the normal height. | 490 | * should be double the normal height. |
4156 | 491 | * Double-height lines are formed of two lines containing the same characters, | 491 | * Double-height lines are formed of two lines containing the same characters, |
4157 | 492 | * with both having the LINE_DOUBLEHEIGHT attribute. | 492 | * with both having the LINE_DOUBLEHEIGHT attribute. |
4158 | @@ -497,24 +497,24 @@ | |||
4159 | 497 | */ | 497 | */ |
4160 | 498 | void setLineProperty(LineProperty property , bool enable); | 498 | void setLineProperty(LineProperty property , bool enable); |
4161 | 499 | 499 | ||
4163 | 500 | /** | 500 | /** |
4164 | 501 | * Returns the number of lines that the image has been scrolled up or down by, | 501 | * Returns the number of lines that the image has been scrolled up or down by, |
4165 | 502 | * since the last call to resetScrolledLines(). | 502 | * since the last call to resetScrolledLines(). |
4166 | 503 | * | 503 | * |
4167 | 504 | * a positive return value indicates that the image has been scrolled up, | 504 | * a positive return value indicates that the image has been scrolled up, |
4169 | 505 | * a negative return value indicates that the image has been scrolled down. | 505 | * a negative return value indicates that the image has been scrolled down. |
4170 | 506 | */ | 506 | */ |
4171 | 507 | int scrolledLines() const; | 507 | int scrolledLines() const; |
4172 | 508 | 508 | ||
4173 | 509 | /** | 509 | /** |
4174 | 510 | * Returns the region of the image which was last scrolled. | 510 | * Returns the region of the image which was last scrolled. |
4175 | 511 | * | 511 | * |
4177 | 512 | * This is the area of the image from the top margin to the | 512 | * This is the area of the image from the top margin to the |
4178 | 513 | * bottom margin when the last scroll occurred. | 513 | * bottom margin when the last scroll occurred. |
4179 | 514 | */ | 514 | */ |
4180 | 515 | QRect lastScrolledRegion() const; | 515 | QRect lastScrolledRegion() const; |
4181 | 516 | 516 | ||
4183 | 517 | /** | 517 | /** |
4184 | 518 | * Resets the count of the number of lines that the image has been scrolled up or down by, | 518 | * Resets the count of the number of lines that the image has been scrolled up or down by, |
4185 | 519 | * see scrolledLines() | 519 | * see scrolledLines() |
4186 | 520 | */ | 520 | */ |
4187 | @@ -527,7 +527,7 @@ | |||
4188 | 527 | * | 527 | * |
4189 | 528 | * If the history is not unlimited then it will drop | 528 | * If the history is not unlimited then it will drop |
4190 | 529 | * the oldest lines of output if new lines are added when | 529 | * the oldest lines of output if new lines are added when |
4192 | 530 | * it is full. | 530 | * it is full. |
4193 | 531 | */ | 531 | */ |
4194 | 532 | int droppedLines() const; | 532 | int droppedLines() const; |
4195 | 533 | 533 | ||
4196 | @@ -537,32 +537,32 @@ | |||
4197 | 537 | */ | 537 | */ |
4198 | 538 | void resetDroppedLines(); | 538 | void resetDroppedLines(); |
4199 | 539 | 539 | ||
4201 | 540 | /** | 540 | /** |
4202 | 541 | * Fills the buffer @p dest with @p count instances of the default (ie. blank) | 541 | * Fills the buffer @p dest with @p count instances of the default (ie. blank) |
4203 | 542 | * Character style. | 542 | * Character style. |
4204 | 543 | */ | 543 | */ |
4205 | 544 | static void fillWithDefaultChar(Character* dest, int count); | 544 | static void fillWithDefaultChar(Character* dest, int count); |
4206 | 545 | 545 | ||
4208 | 546 | private: | 546 | private: |
4209 | 547 | 547 | ||
4211 | 548 | //copies a line of text from the screen or history into a stream using a | 548 | //copies a line of text from the screen or history into a stream using a |
4212 | 549 | //specified character decoder. Returns the number of lines actually copied, | 549 | //specified character decoder. Returns the number of lines actually copied, |
4213 | 550 | //which may be less than 'count' if (start+count) is more than the number of characters on | 550 | //which may be less than 'count' if (start+count) is more than the number of characters on |
4215 | 551 | //the line | 551 | //the line |
4216 | 552 | // | 552 | // |
4218 | 553 | //line - the line number to copy, from 0 (the earliest line in the history) up to | 553 | //line - the line number to copy, from 0 (the earliest line in the history) up to |
4219 | 554 | // history->getLines() + lines - 1 | 554 | // history->getLines() + lines - 1 |
4220 | 555 | //start - the first column on the line to copy | 555 | //start - the first column on the line to copy |
4221 | 556 | //count - the number of characters on the line to copy | 556 | //count - the number of characters on the line to copy |
4222 | 557 | //decoder - a decoder which converts terminal characters (an Character array) into text | 557 | //decoder - a decoder which converts terminal characters (an Character array) into text |
4223 | 558 | //appendNewLine - if true a new line character (\n) is appended to the end of the line | 558 | //appendNewLine - if true a new line character (\n) is appended to the end of the line |
4227 | 559 | int copyLineToStream(int line, | 559 | int copyLineToStream(int line, |
4228 | 560 | int start, | 560 | int start, |
4229 | 561 | int count, | 561 | int count, |
4230 | 562 | TerminalCharacterDecoder* decoder, | 562 | TerminalCharacterDecoder* decoder, |
4231 | 563 | bool appendNewLine, | 563 | bool appendNewLine, |
4232 | 564 | bool preserveLineBreaks) const; | 564 | bool preserveLineBreaks) const; |
4234 | 565 | 565 | ||
4235 | 566 | //fills a section of the screen image with the character 'c' | 566 | //fills a section of the screen image with the character 'c' |
4236 | 567 | //the parameters are specified as offsets from the start of the screen image. | 567 | //the parameters are specified as offsets from the start of the screen image. |
4237 | 568 | //the loc(x,y) macro can be used to generate these values from a column,line pair. | 568 | //the loc(x,y) macro can be used to generate these values from a column,line pair. |
4238 | @@ -574,7 +574,7 @@ | |||
4239 | 574 | // | 574 | // |
4240 | 575 | //NOTE: moveImage() can only move whole lines | 575 | //NOTE: moveImage() can only move whole lines |
4241 | 576 | void moveImage(int dest, int sourceBegin, int sourceEnd); | 576 | void moveImage(int dest, int sourceBegin, int sourceEnd); |
4243 | 577 | // scroll up 'i' lines in current region, clearing the bottom 'i' lines | 577 | // scroll up 'i' lines in current region, clearing the bottom 'i' lines |
4244 | 578 | void scrollUp(int from, int i); | 578 | void scrollUp(int from, int i); |
4245 | 579 | // scroll down 'i' lines in current region, clearing the top 'i' lines | 579 | // scroll down 'i' lines in current region, clearing the top 'i' lines |
4246 | 580 | void scrollDown(int from, int i); | 580 | void scrollDown(int from, int i); |
4247 | @@ -589,7 +589,7 @@ | |||
4248 | 589 | bool isSelectionValid() const; | 589 | bool isSelectionValid() const; |
4249 | 590 | // copies text from 'startIndex' to 'endIndex' to a stream | 590 | // copies text from 'startIndex' to 'endIndex' to a stream |
4250 | 591 | // startIndex and endIndex are positions generated using the loc(x,y) macro | 591 | // startIndex and endIndex are positions generated using the loc(x,y) macro |
4252 | 592 | void writeToStream(TerminalCharacterDecoder* decoder, int startIndex, | 592 | void writeToStream(TerminalCharacterDecoder* decoder, int startIndex, |
4253 | 593 | int endIndex, bool preserveLineBreaks = true) const; | 593 | int endIndex, bool preserveLineBreaks = true) const; |
4254 | 594 | // copies 'count' lines from the screen buffer into 'dest', | 594 | // copies 'count' lines from the screen buffer into 'dest', |
4255 | 595 | // starting from 'startLine', where 0 is the first line in the screen buffer | 595 | // starting from 'startLine', where 0 is the first line in the screen buffer |
4256 | @@ -611,11 +611,11 @@ | |||
4257 | 611 | 611 | ||
4258 | 612 | int _droppedLines; | 612 | int _droppedLines; |
4259 | 613 | 613 | ||
4262 | 614 | QVarLengthArray<LineProperty,64> lineProperties; | 614 | QVarLengthArray<LineProperty,64> lineProperties; |
4263 | 615 | 615 | ||
4264 | 616 | // history buffer --------------- | 616 | // history buffer --------------- |
4265 | 617 | HistoryScroll* history; | 617 | HistoryScroll* history; |
4267 | 618 | 618 | ||
4268 | 619 | // cursor location | 619 | // cursor location |
4269 | 620 | int cuX; | 620 | int cuX; |
4270 | 621 | int cuY; | 621 | int cuY; |
4271 | @@ -623,7 +623,7 @@ | |||
4272 | 623 | // cursor color and rendition info | 623 | // cursor color and rendition info |
4273 | 624 | CharacterColor currentForeground; | 624 | CharacterColor currentForeground; |
4274 | 625 | CharacterColor currentBackground; | 625 | CharacterColor currentBackground; |
4276 | 626 | quint8 currentRendition; | 626 | quint8 currentRendition; |
4277 | 627 | 627 | ||
4278 | 628 | // margins ---------------- | 628 | // margins ---------------- |
4279 | 629 | int _topMargin; | 629 | int _topMargin; |
4280 | @@ -648,7 +648,7 @@ | |||
4281 | 648 | CharacterColor effectiveBackground; // the cu_* variables above | 648 | CharacterColor effectiveBackground; // the cu_* variables above |
4282 | 649 | quint8 effectiveRendition; // to speed up operation | 649 | quint8 effectiveRendition; // to speed up operation |
4283 | 650 | 650 | ||
4285 | 651 | class SavedState | 651 | class SavedState |
4286 | 652 | { | 652 | { |
4287 | 653 | public: | 653 | public: |
4288 | 654 | SavedState() | 654 | SavedState() |
4289 | @@ -661,7 +661,7 @@ | |||
4290 | 661 | CharacterColor background; | 661 | CharacterColor background; |
4291 | 662 | }; | 662 | }; |
4292 | 663 | SavedState savedState; | 663 | SavedState savedState; |
4294 | 664 | 664 | ||
4295 | 665 | // last position where we added a character | 665 | // last position where we added a character |
4296 | 666 | int lastPos; | 666 | int lastPos; |
4297 | 667 | 667 | ||
4298 | 668 | 668 | ||
4299 | === modified file 'src/plugin/konsole/ScreenWindow.cpp' | |||
4300 | --- src/plugin/konsole/ScreenWindow.cpp 2014-04-27 09:11:14 +0000 | |||
4301 | +++ src/plugin/konsole/ScreenWindow.cpp 2014-07-30 09:50:10 +0000 | |||
4302 | @@ -57,7 +57,7 @@ | |||
4303 | 57 | { | 57 | { |
4304 | 58 | // reallocate internal buffer if the window size has changed | 58 | // reallocate internal buffer if the window size has changed |
4305 | 59 | int size = windowLines() * windowColumns(); | 59 | int size = windowLines() * windowColumns(); |
4307 | 60 | if (_windowBuffer == 0 || _windowBufferSize != size) | 60 | if (_windowBuffer == 0 || _windowBufferSize != size) |
4308 | 61 | { | 61 | { |
4309 | 62 | delete[] _windowBuffer; | 62 | delete[] _windowBuffer; |
4310 | 63 | _windowBufferSize = size; | 63 | _windowBufferSize = size; |
4311 | @@ -67,11 +67,11 @@ | |||
4312 | 67 | 67 | ||
4313 | 68 | if (!_bufferNeedsUpdate) | 68 | if (!_bufferNeedsUpdate) |
4314 | 69 | return _windowBuffer; | 69 | return _windowBuffer; |
4316 | 70 | 70 | ||
4317 | 71 | _screen->getImage(_windowBuffer,size, | 71 | _screen->getImage(_windowBuffer,size, |
4318 | 72 | currentLine(),endWindowLine()); | 72 | currentLine(),endWindowLine()); |
4319 | 73 | 73 | ||
4321 | 74 | // this window may look beyond the end of the screen, in which | 74 | // this window may look beyond the end of the screen, in which |
4322 | 75 | // case there will be an unused area which needs to be filled | 75 | // case there will be an unused area which needs to be filled |
4323 | 76 | // with blank characters | 76 | // with blank characters |
4324 | 77 | fillUnusedArea(); | 77 | fillUnusedArea(); |
4325 | @@ -88,10 +88,10 @@ | |||
4326 | 88 | int unusedLines = windowEndLine - screenEndLine; | 88 | int unusedLines = windowEndLine - screenEndLine; |
4327 | 89 | int charsToFill = unusedLines * windowColumns(); | 89 | int charsToFill = unusedLines * windowColumns(); |
4328 | 90 | 90 | ||
4330 | 91 | Screen::fillWithDefaultChar(_windowBuffer + _windowBufferSize - charsToFill,charsToFill); | 91 | Screen::fillWithDefaultChar(_windowBuffer + _windowBufferSize - charsToFill,charsToFill); |
4331 | 92 | } | 92 | } |
4332 | 93 | 93 | ||
4334 | 94 | // return the index of the line at the end of this window, or if this window | 94 | // return the index of the line at the end of this window, or if this window |
4335 | 95 | // goes beyond the end of the screen, the index of the line at the end | 95 | // goes beyond the end of the screen, the index of the line at the end |
4336 | 96 | // of the screen. | 96 | // of the screen. |
4337 | 97 | // | 97 | // |
4338 | @@ -106,7 +106,7 @@ | |||
4339 | 106 | QVector<LineProperty> ScreenWindow::getLineProperties() | 106 | QVector<LineProperty> ScreenWindow::getLineProperties() |
4340 | 107 | { | 107 | { |
4341 | 108 | QVector<LineProperty> result = _screen->getLineProperties(currentLine(),endWindowLine()); | 108 | QVector<LineProperty> result = _screen->getLineProperties(currentLine(),endWindowLine()); |
4343 | 109 | 109 | ||
4344 | 110 | if (result.count() != windowLines()) | 110 | if (result.count() != windowLines()) |
4345 | 111 | result.resize(windowLines()); | 111 | result.resize(windowLines()); |
4346 | 112 | 112 | ||
4347 | @@ -131,7 +131,7 @@ | |||
4348 | 131 | void ScreenWindow::setSelectionStart( int column , int line , bool columnMode ) | 131 | void ScreenWindow::setSelectionStart( int column , int line , bool columnMode ) |
4349 | 132 | { | 132 | { |
4350 | 133 | _screen->setSelectionStart( column , qMin(line + currentLine(),endWindowLine()) , columnMode); | 133 | _screen->setSelectionStart( column , qMin(line + currentLine(),endWindowLine()) , columnMode); |
4352 | 134 | 134 | ||
4353 | 135 | _bufferNeedsUpdate = true; | 135 | _bufferNeedsUpdate = true; |
4354 | 136 | emit selectionChanged(); | 136 | emit selectionChanged(); |
4355 | 137 | } | 137 | } |
4356 | @@ -163,7 +163,7 @@ | |||
4357 | 163 | } | 163 | } |
4358 | 164 | int ScreenWindow::windowLines() const | 164 | int ScreenWindow::windowLines() const |
4359 | 165 | { | 165 | { |
4361 | 166 | return _windowLines; | 166 | return _windowLines; |
4362 | 167 | } | 167 | } |
4363 | 168 | 168 | ||
4364 | 169 | int ScreenWindow::windowColumns() const | 169 | int ScreenWindow::windowColumns() const |
4365 | @@ -184,11 +184,11 @@ | |||
4366 | 184 | QPoint ScreenWindow::cursorPosition() const | 184 | QPoint ScreenWindow::cursorPosition() const |
4367 | 185 | { | 185 | { |
4368 | 186 | QPoint position; | 186 | QPoint position; |
4370 | 187 | 187 | ||
4371 | 188 | position.setX( _screen->getCursorX() ); | 188 | position.setX( _screen->getCursorX() ); |
4372 | 189 | position.setY( _screen->getCursorY() ); | 189 | position.setY( _screen->getCursorY() ); |
4373 | 190 | 190 | ||
4375 | 191 | return position; | 191 | return position; |
4376 | 192 | } | 192 | } |
4377 | 193 | 193 | ||
4378 | 194 | int ScreenWindow::currentLine() const | 194 | int ScreenWindow::currentLine() const |
4379 | @@ -204,7 +204,7 @@ | |||
4380 | 204 | } | 204 | } |
4381 | 205 | else if ( mode == ScrollPages ) | 205 | else if ( mode == ScrollPages ) |
4382 | 206 | { | 206 | { |
4384 | 207 | scrollTo( currentLine() + amount * ( windowLines() / 2 ) ); | 207 | scrollTo( currentLine() + amount * ( windowLines() / 2 ) ); |
4385 | 208 | } | 208 | } |
4386 | 209 | } | 209 | } |
4387 | 210 | 210 | ||
4388 | @@ -245,7 +245,7 @@ | |||
4389 | 245 | return _scrollCount; | 245 | return _scrollCount; |
4390 | 246 | } | 246 | } |
4391 | 247 | 247 | ||
4393 | 248 | void ScreenWindow::resetScrollCount() | 248 | void ScreenWindow::resetScrollCount() |
4394 | 249 | { | 249 | { |
4395 | 250 | _scrollCount = 0; | 250 | _scrollCount = 0; |
4396 | 251 | } | 251 | } |
4397 | @@ -265,18 +265,18 @@ | |||
4398 | 265 | // move window to the bottom of the screen and update scroll count | 265 | // move window to the bottom of the screen and update scroll count |
4399 | 266 | // if this window is currently tracking the bottom of the screen | 266 | // if this window is currently tracking the bottom of the screen |
4400 | 267 | if ( _trackOutput ) | 267 | if ( _trackOutput ) |
4402 | 268 | { | 268 | { |
4403 | 269 | _scrollCount -= _screen->scrolledLines(); | 269 | _scrollCount -= _screen->scrolledLines(); |
4404 | 270 | _currentLine = qMax(0,_screen->getHistLines() - (windowLines()-_screen->getLines())); | 270 | _currentLine = qMax(0,_screen->getHistLines() - (windowLines()-_screen->getLines())); |
4405 | 271 | } | 271 | } |
4406 | 272 | else | 272 | else |
4407 | 273 | { | 273 | { |
4409 | 274 | // if the history is not unlimited then it may | 274 | // if the history is not unlimited then it may |
4410 | 275 | // have run out of space and dropped the oldest | 275 | // have run out of space and dropped the oldest |
4411 | 276 | // lines of output - in this case the screen | 276 | // lines of output - in this case the screen |
4413 | 277 | // window's current line number will need to | 277 | // window's current line number will need to |
4414 | 278 | // be adjusted - otherwise the output will scroll | 278 | // be adjusted - otherwise the output will scroll |
4416 | 279 | _currentLine = qMax(0,_currentLine - | 279 | _currentLine = qMax(0,_currentLine - |
4417 | 280 | _screen->droppedLines()); | 280 | _screen->droppedLines()); |
4418 | 281 | 281 | ||
4419 | 282 | // ensure that the screen window's current position does | 282 | // ensure that the screen window's current position does |
4420 | @@ -286,7 +286,7 @@ | |||
4421 | 286 | 286 | ||
4422 | 287 | _bufferNeedsUpdate = true; | 287 | _bufferNeedsUpdate = true; |
4423 | 288 | 288 | ||
4425 | 289 | emit outputChanged(); | 289 | emit outputChanged(); |
4426 | 290 | } | 290 | } |
4427 | 291 | 291 | ||
4428 | 292 | //#include "ScreenWindow.moc" | 292 | //#include "ScreenWindow.moc" |
4429 | 293 | 293 | ||
4430 | === modified file 'src/plugin/konsole/ScreenWindow.h' | |||
4431 | --- src/plugin/konsole/ScreenWindow.h 2014-04-27 09:11:14 +0000 | |||
4432 | +++ src/plugin/konsole/ScreenWindow.h 2014-07-30 09:50:10 +0000 | |||
4433 | @@ -33,7 +33,7 @@ | |||
4434 | 33 | 33 | ||
4435 | 34 | /** | 34 | /** |
4436 | 35 | * Provides a window onto a section of a terminal screen. A terminal widget can then render | 35 | * Provides a window onto a section of a terminal screen. A terminal widget can then render |
4438 | 36 | * the contents of the window and use the window to change the terminal screen's selection | 36 | * the contents of the window and use the window to change the terminal screen's selection |
4439 | 37 | * in response to mouse or keyboard input. | 37 | * in response to mouse or keyboard input. |
4440 | 38 | * | 38 | * |
4441 | 39 | * A new ScreenWindow for a terminal session can be created by calling Emulation::createWindow() | 39 | * A new ScreenWindow for a terminal session can be created by calling Emulation::createWindow() |
4442 | @@ -53,7 +53,7 @@ | |||
4443 | 53 | Q_OBJECT | 53 | Q_OBJECT |
4444 | 54 | 54 | ||
4445 | 55 | public: | 55 | public: |
4447 | 56 | /** | 56 | /** |
4448 | 57 | * Constructs a new screen window with the given parent. | 57 | * Constructs a new screen window with the given parent. |
4449 | 58 | * A screen must be specified by calling setScreen() before calling getImage() or getLineProperties(). | 58 | * A screen must be specified by calling setScreen() before calling getImage() or getLineProperties(). |
4450 | 59 | * | 59 | * |
4451 | @@ -70,7 +70,7 @@ | |||
4452 | 70 | /** Returns the screen which this window looks onto */ | 70 | /** Returns the screen which this window looks onto */ |
4453 | 71 | Screen* screen() const; | 71 | Screen* screen() const; |
4454 | 72 | 72 | ||
4456 | 73 | /** | 73 | /** |
4457 | 74 | * Returns the image of characters which are currently visible through this window | 74 | * Returns the image of characters which are currently visible through this window |
4458 | 75 | * onto the screen. | 75 | * onto the screen. |
4459 | 76 | * | 76 | * |
4460 | @@ -87,14 +87,14 @@ | |||
4461 | 87 | 87 | ||
4462 | 88 | /** | 88 | /** |
4463 | 89 | * Returns the number of lines which the region of the window | 89 | * Returns the number of lines which the region of the window |
4466 | 90 | * specified by scrollRegion() has been scrolled by since the last call | 90 | * specified by scrollRegion() has been scrolled by since the last call |
4467 | 91 | * to resetScrollCount(). scrollRegion() is in most cases the | 91 | * to resetScrollCount(). scrollRegion() is in most cases the |
4468 | 92 | * whole window, but will be a smaller area in, for example, applications | 92 | * whole window, but will be a smaller area in, for example, applications |
4469 | 93 | * which provide split-screen facilities. | 93 | * which provide split-screen facilities. |
4470 | 94 | * | 94 | * |
4471 | 95 | * This is not guaranteed to be accurate, but allows views to optimize | 95 | * This is not guaranteed to be accurate, but allows views to optimize |
4472 | 96 | * rendering by reducing the amount of costly text rendering that | 96 | * rendering by reducing the amount of costly text rendering that |
4474 | 97 | * needs to be done when the output is scrolled. | 97 | * needs to be done when the output is scrolled. |
4475 | 98 | */ | 98 | */ |
4476 | 99 | int scrollCount() const; | 99 | int scrollCount() const; |
4477 | 100 | 100 | ||
4478 | @@ -104,7 +104,7 @@ | |||
4479 | 104 | void resetScrollCount(); | 104 | void resetScrollCount(); |
4480 | 105 | 105 | ||
4481 | 106 | /** | 106 | /** |
4483 | 107 | * Returns the area of the window which was last scrolled, this is | 107 | * Returns the area of the window which was last scrolled, this is |
4484 | 108 | * usually the whole window area. | 108 | * usually the whole window area. |
4485 | 109 | * | 109 | * |
4486 | 110 | * Like scrollCount(), this is not guaranteed to be accurate, | 110 | * Like scrollCount(), this is not guaranteed to be accurate, |
4487 | @@ -112,8 +112,8 @@ | |||
4488 | 112 | */ | 112 | */ |
4489 | 113 | QRect scrollRegion() const; | 113 | QRect scrollRegion() const; |
4490 | 114 | 114 | ||
4493 | 115 | /** | 115 | /** |
4494 | 116 | * Sets the start of the selection to the given @p line and @p column within | 116 | * Sets the start of the selection to the given @p line and @p column within |
4495 | 117 | * the window. | 117 | * the window. |
4496 | 118 | */ | 118 | */ |
4497 | 119 | void setSelectionStart( int column , int line , bool columnMode ); | 119 | void setSelectionStart( int column , int line , bool columnMode ); |
4498 | @@ -121,7 +121,7 @@ | |||
4499 | 121 | * Sets the end of the selection to the given @p line and @p column within | 121 | * Sets the end of the selection to the given @p line and @p column within |
4500 | 122 | * the window. | 122 | * the window. |
4501 | 123 | */ | 123 | */ |
4503 | 124 | void setSelectionEnd( int column , int line ); | 124 | void setSelectionEnd( int column , int line ); |
4504 | 125 | /** | 125 | /** |
4505 | 126 | * Retrieves the start of the selection within the window. | 126 | * Retrieves the start of the selection within the window. |
4506 | 127 | */ | 127 | */ |
4507 | @@ -134,7 +134,7 @@ | |||
4508 | 134 | * Returns true if the character at @p line , @p column is part of the selection. | 134 | * Returns true if the character at @p line , @p column is part of the selection. |
4509 | 135 | */ | 135 | */ |
4510 | 136 | bool isSelected( int column , int line ); | 136 | bool isSelected( int column , int line ); |
4512 | 137 | /** | 137 | /** |
4513 | 138 | * Clears the current selection | 138 | * Clears the current selection |
4514 | 139 | */ | 139 | */ |
4515 | 140 | void clearSelection(); | 140 | void clearSelection(); |
4516 | @@ -145,7 +145,7 @@ | |||
4517 | 145 | int windowLines() const; | 145 | int windowLines() const; |
4518 | 146 | /** Returns the number of columns in the window */ | 146 | /** Returns the number of columns in the window */ |
4519 | 147 | int windowColumns() const; | 147 | int windowColumns() const; |
4521 | 148 | 148 | ||
4522 | 149 | /** Returns the total number of lines in the screen */ | 149 | /** Returns the total number of lines in the screen */ |
4523 | 150 | int lineCount() const; | 150 | int lineCount() const; |
4524 | 151 | /** Returns the total number of columns in the screen */ | 151 | /** Returns the total number of columns in the screen */ |
4525 | @@ -154,13 +154,13 @@ | |||
4526 | 154 | /** Returns the index of the line which is currently at the top of this window */ | 154 | /** Returns the index of the line which is currently at the top of this window */ |
4527 | 155 | int currentLine() const; | 155 | int currentLine() const; |
4528 | 156 | 156 | ||
4531 | 157 | /** | 157 | /** |
4532 | 158 | * Returns the position of the cursor | 158 | * Returns the position of the cursor |
4533 | 159 | * within the window. | 159 | * within the window. |
4534 | 160 | */ | 160 | */ |
4535 | 161 | QPoint cursorPosition() const; | 161 | QPoint cursorPosition() const; |
4536 | 162 | 162 | ||
4538 | 163 | /** | 163 | /** |
4539 | 164 | * Convenience method. Returns true if the window is currently at the bottom | 164 | * Convenience method. Returns true if the window is currently at the bottom |
4540 | 165 | * of the screen. | 165 | * of the screen. |
4541 | 166 | */ | 166 | */ |
4542 | @@ -174,33 +174,33 @@ | |||
4543 | 174 | { | 174 | { |
4544 | 175 | /** Scroll the window down by a given number of lines. */ | 175 | /** Scroll the window down by a given number of lines. */ |
4545 | 176 | ScrollLines, | 176 | ScrollLines, |
4547 | 177 | /** | 177 | /** |
4548 | 178 | * Scroll the window down by a given number of pages, where | 178 | * Scroll the window down by a given number of pages, where |
4549 | 179 | * one page is windowLines() lines | 179 | * one page is windowLines() lines |
4550 | 180 | */ | 180 | */ |
4551 | 181 | ScrollPages | 181 | ScrollPages |
4552 | 182 | }; | 182 | }; |
4553 | 183 | 183 | ||
4555 | 184 | /** | 184 | /** |
4556 | 185 | * Scrolls the window relative to its current position on the screen. | 185 | * Scrolls the window relative to its current position on the screen. |
4557 | 186 | * | 186 | * |
4558 | 187 | * @param mode Specifies whether @p amount refers to the number of lines or the number | 187 | * @param mode Specifies whether @p amount refers to the number of lines or the number |
4560 | 188 | * of pages to scroll. | 188 | * of pages to scroll. |
4561 | 189 | * @param amount The number of lines or pages ( depending on @p mode ) to scroll by. If | 189 | * @param amount The number of lines or pages ( depending on @p mode ) to scroll by. If |
4562 | 190 | * this number is positive, the view is scrolled down. If this number is negative, the view | 190 | * this number is positive, the view is scrolled down. If this number is negative, the view |
4563 | 191 | * is scrolled up. | 191 | * is scrolled up. |
4564 | 192 | */ | 192 | */ |
4565 | 193 | void scrollBy( RelativeScrollMode mode , int amount ); | 193 | void scrollBy( RelativeScrollMode mode , int amount ); |
4566 | 194 | 194 | ||
4568 | 195 | /** | 195 | /** |
4569 | 196 | * Specifies whether the window should automatically move to the bottom | 196 | * Specifies whether the window should automatically move to the bottom |
4570 | 197 | * of the screen when new output is added. | 197 | * of the screen when new output is added. |
4571 | 198 | * | 198 | * |
4573 | 199 | * If this is set to true, the window will be moved to the bottom of the associated screen ( see | 199 | * If this is set to true, the window will be moved to the bottom of the associated screen ( see |
4574 | 200 | * screen() ) when the notifyOutputChanged() method is called. | 200 | * screen() ) when the notifyOutputChanged() method is called. |
4575 | 201 | */ | 201 | */ |
4576 | 202 | void setTrackOutput(bool trackOutput); | 202 | void setTrackOutput(bool trackOutput); |
4578 | 203 | /** | 203 | /** |
4579 | 204 | * Returns whether the window automatically moves to the bottom of the screen as | 204 | * Returns whether the window automatically moves to the bottom of the screen as |
4580 | 205 | * new output is added. See setTrackOutput() | 205 | * new output is added. See setTrackOutput() |
4581 | 206 | */ | 206 | */ |
4582 | @@ -214,7 +214,7 @@ | |||
4583 | 214 | QString selectedText( bool preserveLineBreaks ) const; | 214 | QString selectedText( bool preserveLineBreaks ) const; |
4584 | 215 | 215 | ||
4585 | 216 | public slots: | 216 | public slots: |
4587 | 217 | /** | 217 | /** |
4588 | 218 | * Notifies the window that the contents of the associated terminal screen have changed. | 218 | * Notifies the window that the contents of the associated terminal screen have changed. |
4589 | 219 | * This moves the window to the bottom of the screen if trackOutput() is true and causes | 219 | * This moves the window to the bottom of the screen if trackOutput() is true and causes |
4590 | 220 | * the outputChanged() signal to be emitted. | 220 | * the outputChanged() signal to be emitted. |
4591 | @@ -223,13 +223,13 @@ | |||
4592 | 223 | 223 | ||
4593 | 224 | signals: | 224 | signals: |
4594 | 225 | /** | 225 | /** |
4596 | 226 | * Emitted when the contents of the associated terminal screen (see screen()) changes. | 226 | * Emitted when the contents of the associated terminal screen (see screen()) changes. |
4597 | 227 | */ | 227 | */ |
4598 | 228 | void outputChanged(); | 228 | void outputChanged(); |
4599 | 229 | 229 | ||
4600 | 230 | /** | 230 | /** |
4601 | 231 | * Emitted when the screen window is scrolled to a different position. | 231 | * Emitted when the screen window is scrolled to a different position. |
4603 | 232 | * | 232 | * |
4604 | 233 | * @param line The line which is now at the top of the window. | 233 | * @param line The line which is now at the top of the window. |
4605 | 234 | */ | 234 | */ |
4606 | 235 | void scrolled(int line); | 235 | void scrolled(int line); |
4607 | @@ -248,7 +248,7 @@ | |||
4608 | 248 | 248 | ||
4609 | 249 | int _windowLines; | 249 | int _windowLines; |
4610 | 250 | int _currentLine; // see scrollTo() , currentLine() | 250 | int _currentLine; // see scrollTo() , currentLine() |
4612 | 251 | bool _trackOutput; // see setTrackOutput() , trackOutput() | 251 | bool _trackOutput; // see setTrackOutput() , trackOutput() |
4613 | 252 | int _scrollCount; // count of lines which the window has been scrolled by since | 252 | int _scrollCount; // count of lines which the window has been scrolled by since |
4614 | 253 | // the last call to resetScrollCount() | 253 | // the last call to resetScrollCount() |
4615 | 254 | }; | 254 | }; |
4616 | 255 | 255 | ||
4617 | === modified file 'src/plugin/konsole/TerminalCharacterDecoder.cpp' | |||
4618 | --- src/plugin/konsole/TerminalCharacterDecoder.cpp 2014-04-27 09:11:14 +0000 | |||
4619 | +++ src/plugin/konsole/TerminalCharacterDecoder.cpp 2014-07-30 09:50:10 +0000 | |||
4620 | @@ -1,8 +1,8 @@ | |||
4621 | 1 | /* | 1 | /* |
4622 | 2 | This file is part of Konsole, an X terminal. | 2 | This file is part of Konsole, an X terminal. |
4624 | 3 | 3 | ||
4625 | 4 | Copyright 2006-2008 by Robert Knight <robertknight@gmail.com> | 4 | Copyright 2006-2008 by Robert Knight <robertknight@gmail.com> |
4627 | 5 | 5 | ||
4628 | 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
4629 | 7 | it under the terms of the GNU Lesser General Public License as published by | 7 | it under the terms of the GNU Lesser General Public License as published by |
4630 | 8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
4631 | @@ -84,7 +84,7 @@ | |||
4632 | 84 | //(since QTextStream always deals with QStrings internally anyway) | 84 | //(since QTextStream always deals with QStrings internally anyway) |
4633 | 85 | QString plainText; | 85 | QString plainText; |
4634 | 86 | plainText.reserve(count); | 86 | plainText.reserve(count); |
4636 | 87 | 87 | ||
4637 | 88 | int outputCount = count; | 88 | int outputCount = count; |
4638 | 89 | 89 | ||
4639 | 90 | // if inclusion of trailing whitespace is disabled then find the end of the | 90 | // if inclusion of trailing whitespace is disabled then find the end of the |
4640 | @@ -99,7 +99,7 @@ | |||
4641 | 99 | outputCount--; | 99 | outputCount--; |
4642 | 100 | } | 100 | } |
4643 | 101 | } | 101 | } |
4645 | 102 | 102 | ||
4646 | 103 | for (int i=0;i<outputCount;) | 103 | for (int i=0;i<outputCount;) |
4647 | 104 | { | 104 | { |
4648 | 105 | plainText.append( QChar(characters[i].character) ); | 105 | plainText.append( QChar(characters[i].character) ); |
4649 | @@ -114,7 +114,7 @@ | |||
4650 | 114 | ,_innerSpanOpen(false) | 114 | ,_innerSpanOpen(false) |
4651 | 115 | ,_lastRendition(DEFAULT_RENDITION) | 115 | ,_lastRendition(DEFAULT_RENDITION) |
4652 | 116 | { | 116 | { |
4654 | 117 | 117 | ||
4655 | 118 | } | 118 | } |
4656 | 119 | 119 | ||
4657 | 120 | void HTMLDecoder::begin(QTextStream* output) | 120 | void HTMLDecoder::begin(QTextStream* output) |
4658 | @@ -152,7 +152,7 @@ | |||
4659 | 152 | QString text; | 152 | QString text; |
4660 | 153 | 153 | ||
4661 | 154 | int spaceCount = 0; | 154 | int spaceCount = 0; |
4663 | 155 | 155 | ||
4664 | 156 | for (int i=0;i<count;i++) | 156 | for (int i=0;i<count;i++) |
4665 | 157 | { | 157 | { |
4666 | 158 | QChar ch(characters[i].character); | 158 | QChar ch(characters[i].character); |
4667 | @@ -168,7 +168,7 @@ | |||
4668 | 168 | _lastRendition = characters[i].rendition; | 168 | _lastRendition = characters[i].rendition; |
4669 | 169 | _lastForeColor = characters[i].foregroundColor; | 169 | _lastForeColor = characters[i].foregroundColor; |
4670 | 170 | _lastBackColor = characters[i].backgroundColor; | 170 | _lastBackColor = characters[i].backgroundColor; |
4672 | 171 | 171 | ||
4673 | 172 | //build up style string | 172 | //build up style string |
4674 | 173 | QString style; | 173 | QString style; |
4675 | 174 | 174 | ||
4676 | @@ -178,15 +178,15 @@ | |||
4677 | 178 | useBold = _lastRendition & RE_BOLD; | 178 | useBold = _lastRendition & RE_BOLD; |
4678 | 179 | else | 179 | else |
4679 | 180 | useBold = weight == ColorEntry::Bold; | 180 | useBold = weight == ColorEntry::Bold; |
4681 | 181 | 181 | ||
4682 | 182 | if (useBold) | 182 | if (useBold) |
4683 | 183 | style.append("font-weight:bold;"); | 183 | style.append("font-weight:bold;"); |
4684 | 184 | 184 | ||
4685 | 185 | if ( _lastRendition & RE_UNDERLINE ) | 185 | if ( _lastRendition & RE_UNDERLINE ) |
4686 | 186 | style.append("font-decoration:underline;"); | 186 | style.append("font-decoration:underline;"); |
4688 | 187 | 187 | ||
4689 | 188 | //colours - a colour table must have been defined first | 188 | //colours - a colour table must have been defined first |
4691 | 189 | if ( _colorTable ) | 189 | if ( _colorTable ) |
4692 | 190 | { | 190 | { |
4693 | 191 | style.append( QString("color:%1;").arg(_lastForeColor.color(_colorTable).name() ) ); | 191 | style.append( QString("color:%1;").arg(_lastForeColor.color(_colorTable).name() ) ); |
4694 | 192 | 192 | ||
4695 | @@ -195,8 +195,8 @@ | |||
4696 | 195 | style.append( QString("background-color:%1;").arg(_lastBackColor.color(_colorTable).name() ) ); | 195 | style.append( QString("background-color:%1;").arg(_lastBackColor.color(_colorTable).name() ) ); |
4697 | 196 | } | 196 | } |
4698 | 197 | } | 197 | } |
4701 | 198 | 198 | ||
4702 | 199 | //open the span with the current style | 199 | //open the span with the current style |
4703 | 200 | openSpan(text,style); | 200 | openSpan(text,style); |
4704 | 201 | _innerSpanOpen = true; | 201 | _innerSpanOpen = true; |
4705 | 202 | } | 202 | } |
4706 | @@ -206,7 +206,7 @@ | |||
4707 | 206 | spaceCount++; | 206 | spaceCount++; |
4708 | 207 | else | 207 | else |
4709 | 208 | spaceCount = 0; | 208 | spaceCount = 0; |
4711 | 209 | 209 | ||
4712 | 210 | 210 | ||
4713 | 211 | //output current character | 211 | //output current character |
4714 | 212 | if (spaceCount < 2) | 212 | if (spaceCount < 2) |
4715 | @@ -216,14 +216,14 @@ | |||
4716 | 216 | text.append("<"); | 216 | text.append("<"); |
4717 | 217 | else if (ch == '>') | 217 | else if (ch == '>') |
4718 | 218 | text.append(">"); | 218 | text.append(">"); |
4720 | 219 | else | 219 | else |
4721 | 220 | text.append(ch); | 220 | text.append(ch); |
4722 | 221 | } | 221 | } |
4723 | 222 | else | 222 | else |
4724 | 223 | { | 223 | { |
4725 | 224 | text.append(" "); //HTML truncates multiple spaces, so use a space marker instead | 224 | text.append(" "); //HTML truncates multiple spaces, so use a space marker instead |
4726 | 225 | } | 225 | } |
4728 | 226 | 226 | ||
4729 | 227 | } | 227 | } |
4730 | 228 | 228 | ||
4731 | 229 | //close any remaining open inner spans | 229 | //close any remaining open inner spans |
4732 | @@ -232,7 +232,7 @@ | |||
4733 | 232 | 232 | ||
4734 | 233 | //start new line | 233 | //start new line |
4735 | 234 | text.append("<br>"); | 234 | text.append("<br>"); |
4737 | 235 | 235 | ||
4738 | 236 | *_output << text; | 236 | *_output << text; |
4739 | 237 | } | 237 | } |
4740 | 238 | void HTMLDecoder::openSpan(QString& text , const QString& style) | 238 | void HTMLDecoder::openSpan(QString& text , const QString& style) |
4741 | 239 | 239 | ||
4742 | === modified file 'src/plugin/konsole/TerminalCharacterDecoder.h' | |||
4743 | --- src/plugin/konsole/TerminalCharacterDecoder.h 2014-04-27 09:11:14 +0000 | |||
4744 | +++ src/plugin/konsole/TerminalCharacterDecoder.h 2014-07-30 09:50:10 +0000 | |||
4745 | @@ -1,8 +1,8 @@ | |||
4746 | 1 | /* | 1 | /* |
4747 | 2 | This file is part of Konsole, an X terminal. | 2 | This file is part of Konsole, an X terminal. |
4749 | 3 | 3 | ||
4750 | 4 | Copyright 2006-2008 by Robert Knight <robertknight@gmail.com> | 4 | Copyright 2006-2008 by Robert Knight <robertknight@gmail.com> |
4752 | 5 | 5 | ||
4753 | 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
4754 | 7 | it under the terms of the GNU Lesser General Public License as published by | 7 | it under the terms of the GNU Lesser General Public License as published by |
4755 | 8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
4756 | @@ -37,7 +37,7 @@ | |||
4757 | 37 | * and background colours and other appearance-related properties into text strings. | 37 | * and background colours and other appearance-related properties into text strings. |
4758 | 38 | * | 38 | * |
4759 | 39 | * Derived classes may produce either plain text with no other colour or appearance information, or | 39 | * Derived classes may produce either plain text with no other colour or appearance information, or |
4761 | 40 | * they may produce text which incorporates these additional properties. | 40 | * they may produce text which incorporates these additional properties. |
4762 | 41 | */ | 41 | */ |
4763 | 42 | class TerminalCharacterDecoder | 42 | class TerminalCharacterDecoder |
4764 | 43 | { | 43 | { |
4765 | @@ -57,9 +57,9 @@ | |||
4766 | 57 | * @param count The number of characters | 57 | * @param count The number of characters |
4767 | 58 | * @param properties Additional properties which affect all characters in the line | 58 | * @param properties Additional properties which affect all characters in the line |
4768 | 59 | */ | 59 | */ |
4770 | 60 | virtual void decodeLine(const Character* const characters, | 60 | virtual void decodeLine(const Character* const characters, |
4771 | 61 | int count, | 61 | int count, |
4773 | 62 | LineProperty properties) = 0; | 62 | LineProperty properties) = 0; |
4774 | 63 | }; | 63 | }; |
4775 | 64 | 64 | ||
4776 | 65 | /** | 65 | /** |
4777 | @@ -69,10 +69,10 @@ | |||
4778 | 69 | class PlainTextDecoder : public TerminalCharacterDecoder | 69 | class PlainTextDecoder : public TerminalCharacterDecoder |
4779 | 70 | { | 70 | { |
4780 | 71 | public: | 71 | public: |
4782 | 72 | PlainTextDecoder(); | 72 | PlainTextDecoder(); |
4783 | 73 | 73 | ||
4786 | 74 | /** | 74 | /** |
4787 | 75 | * Set whether trailing whitespace at the end of lines should be included | 75 | * Set whether trailing whitespace at the end of lines should be included |
4788 | 76 | * in the output. | 76 | * in the output. |
4789 | 77 | * Defaults to true. | 77 | * Defaults to true. |
4790 | 78 | */ | 78 | */ |
4791 | @@ -82,9 +82,9 @@ | |||
4792 | 82 | * in the output. | 82 | * in the output. |
4793 | 83 | */ | 83 | */ |
4794 | 84 | bool trailingWhitespace() const; | 84 | bool trailingWhitespace() const; |
4796 | 85 | /** | 85 | /** |
4797 | 86 | * Returns of character positions in the output stream | 86 | * Returns of character positions in the output stream |
4799 | 87 | * at which new lines where added. Returns an empty if setTrackLinePositions() is false or if | 87 | * at which new lines where added. Returns an empty if setTrackLinePositions() is false or if |
4800 | 88 | * the output device is not a string. | 88 | * the output device is not a string. |
4801 | 89 | */ | 89 | */ |
4802 | 90 | QList<int> linePositions() const; | 90 | QList<int> linePositions() const; |
4803 | @@ -96,9 +96,9 @@ | |||
4804 | 96 | 96 | ||
4805 | 97 | virtual void decodeLine(const Character* const characters, | 97 | virtual void decodeLine(const Character* const characters, |
4806 | 98 | int count, | 98 | int count, |
4810 | 99 | LineProperty properties); | 99 | LineProperty properties); |
4811 | 100 | 100 | ||
4812 | 101 | 101 | ||
4813 | 102 | private: | 102 | private: |
4814 | 103 | QTextStream* _output; | 103 | QTextStream* _output; |
4815 | 104 | bool _includeTrailingWhitespace; | 104 | bool _includeTrailingWhitespace; |
4816 | @@ -113,7 +113,7 @@ | |||
4817 | 113 | class HTMLDecoder : public TerminalCharacterDecoder | 113 | class HTMLDecoder : public TerminalCharacterDecoder |
4818 | 114 | { | 114 | { |
4819 | 115 | public: | 115 | public: |
4821 | 116 | /** | 116 | /** |
4822 | 117 | * Constructs an HTML decoder using a default black-on-white color scheme. | 117 | * Constructs an HTML decoder using a default black-on-white color scheme. |
4823 | 118 | */ | 118 | */ |
4824 | 119 | HTMLDecoder(); | 119 | HTMLDecoder(); |
4825 | @@ -123,7 +123,7 @@ | |||
4826 | 123 | * output | 123 | * output |
4827 | 124 | */ | 124 | */ |
4828 | 125 | void setColorTable( const ColorEntry* table ); | 125 | void setColorTable( const ColorEntry* table ); |
4830 | 126 | 126 | ||
4831 | 127 | virtual void decodeLine(const Character* const characters, | 127 | virtual void decodeLine(const Character* const characters, |
4832 | 128 | int count, | 128 | int count, |
4833 | 129 | LineProperty properties); | 129 | LineProperty properties); |
4834 | @@ -137,7 +137,7 @@ | |||
4835 | 137 | 137 | ||
4836 | 138 | QTextStream* _output; | 138 | QTextStream* _output; |
4837 | 139 | const ColorEntry* _colorTable; | 139 | const ColorEntry* _colorTable; |
4839 | 140 | bool _innerSpanOpen; | 140 | bool _innerSpanOpen; |
4840 | 141 | quint8 _lastRendition; | 141 | quint8 _lastRendition; |
4841 | 142 | CharacterColor _lastForeColor; | 142 | CharacterColor _lastForeColor; |
4842 | 143 | CharacterColor _lastBackColor; | 143 | CharacterColor _lastBackColor; |
4843 | 144 | 144 | ||
4844 | === modified file 'src/plugin/konsole/Vt102Emulation.cpp' | |||
4845 | --- src/plugin/konsole/Vt102Emulation.cpp 2014-04-27 09:11:14 +0000 | |||
4846 | +++ src/plugin/konsole/Vt102Emulation.cpp 2014-07-30 09:50:10 +0000 | |||
4847 | @@ -1,6 +1,6 @@ | |||
4848 | 1 | /* | 1 | /* |
4849 | 2 | This file is part of Konsole, an X terminal. | 2 | This file is part of Konsole, an X terminal. |
4851 | 3 | 3 | ||
4852 | 4 | Copyright 2007-2008 by Robert Knight <robert.knight@gmail.com> | 4 | Copyright 2007-2008 by Robert Knight <robert.knight@gmail.com> |
4853 | 5 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> | 5 | Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de> |
4854 | 6 | 6 | ||
4855 | @@ -37,7 +37,7 @@ | |||
4856 | 37 | void scrolllock_set_on(); | 37 | void scrolllock_set_on(); |
4857 | 38 | #endif | 38 | #endif |
4858 | 39 | 39 | ||
4860 | 40 | // Standard | 40 | // Standard |
4861 | 41 | #include <stdio.h> | 41 | #include <stdio.h> |
4862 | 42 | #include <unistd.h> | 42 | #include <unistd.h> |
4863 | 43 | #include <assert.h> | 43 | #include <assert.h> |
4864 | @@ -55,7 +55,7 @@ | |||
4865 | 55 | #include "KeyboardTranslator.h" | 55 | #include "KeyboardTranslator.h" |
4866 | 56 | #include "Screen.h" | 56 | #include "Screen.h" |
4867 | 57 | 57 | ||
4869 | 58 | Vt102Emulation::Vt102Emulation() | 58 | Vt102Emulation::Vt102Emulation() |
4870 | 59 | : Emulation(), | 59 | : Emulation(), |
4871 | 60 | _titleUpdateTimer(new QTimer(this)) | 60 | _titleUpdateTimer(new QTimer(this)) |
4872 | 61 | { | 61 | { |
4873 | @@ -72,7 +72,7 @@ | |||
4874 | 72 | void Vt102Emulation::clearEntireScreen() | 72 | void Vt102Emulation::clearEntireScreen() |
4875 | 73 | { | 73 | { |
4876 | 74 | _currentScreen->clearEntireScreen(); | 74 | _currentScreen->clearEntireScreen(); |
4878 | 75 | bufferedUpdate(); | 75 | bufferedUpdate(); |
4879 | 76 | } | 76 | } |
4880 | 77 | 77 | ||
4881 | 78 | void Vt102Emulation::reset() | 78 | void Vt102Emulation::reset() |
4882 | @@ -84,7 +84,7 @@ | |||
4883 | 84 | resetCharset(1); | 84 | resetCharset(1); |
4884 | 85 | _screen[1]->reset(); | 85 | _screen[1]->reset(); |
4885 | 86 | setCodec(LocaleCodec); | 86 | setCodec(LocaleCodec); |
4887 | 87 | 87 | ||
4888 | 88 | bufferedUpdate(); | 88 | bufferedUpdate(); |
4889 | 89 | } | 89 | } |
4890 | 90 | 90 | ||
4891 | @@ -135,7 +135,7 @@ | |||
4892 | 135 | - VT52 - VT52 escape codes | 135 | - VT52 - VT52 escape codes |
4893 | 136 | - <ESC><Chr> | 136 | - <ESC><Chr> |
4894 | 137 | - <ESC>'Y'{Pc}{Pc} | 137 | - <ESC>'Y'{Pc}{Pc} |
4896 | 138 | - XTE_HA - Xterm window/terminal attribute commands | 138 | - XTE_HA - Xterm window/terminal attribute commands |
4897 | 139 | of the form <ESC>`]' {Pn} `;' {Text} <BEL> | 139 | of the form <ESC>`]' {Pn} `;' {Text} <BEL> |
4898 | 140 | (Note that these are handled differently to the other formats) | 140 | (Note that these are handled differently to the other formats) |
4899 | 141 | 141 | ||
4900 | @@ -175,9 +175,9 @@ | |||
4901 | 175 | 175 | ||
4902 | 176 | void Vt102Emulation::resetTokenizer() | 176 | void Vt102Emulation::resetTokenizer() |
4903 | 177 | { | 177 | { |
4907 | 178 | tokenBufferPos = 0; | 178 | tokenBufferPos = 0; |
4908 | 179 | argc = 0; | 179 | argc = 0; |
4909 | 180 | argv[0] = 0; | 180 | argv[0] = 0; |
4910 | 181 | argv[1] = 0; | 181 | argv[1] = 0; |
4911 | 182 | } | 182 | } |
4912 | 183 | 183 | ||
4913 | @@ -203,33 +203,33 @@ | |||
4914 | 203 | 203 | ||
4915 | 204 | #define CTL 1 // Control character | 204 | #define CTL 1 // Control character |
4916 | 205 | #define CHR 2 // Printable character | 205 | #define CHR 2 // Printable character |
4918 | 206 | #define CPN 4 // TODO: Document me | 206 | #define CPN 4 // TODO: Document me |
4919 | 207 | #define DIG 8 // Digit | 207 | #define DIG 8 // Digit |
4921 | 208 | #define SCS 16 // TODO: Document me | 208 | #define SCS 16 // TODO: Document me |
4922 | 209 | #define GRP 32 // TODO: Document me | 209 | #define GRP 32 // TODO: Document me |
4923 | 210 | #define CPS 64 // Character which indicates end of window resize | 210 | #define CPS 64 // Character which indicates end of window resize |
4924 | 211 | // escape sequence '\e[8;<row>;<col>t' | 211 | // escape sequence '\e[8;<row>;<col>t' |
4925 | 212 | 212 | ||
4926 | 213 | void Vt102Emulation::initTokenizer() | 213 | void Vt102Emulation::initTokenizer() |
4929 | 214 | { | 214 | { |
4930 | 215 | int i; | 215 | int i; |
4931 | 216 | quint8* s; | 216 | quint8* s; |
4933 | 217 | for(i = 0;i < 256; ++i) | 217 | for(i = 0;i < 256; ++i) |
4934 | 218 | charClass[i] = 0; | 218 | charClass[i] = 0; |
4936 | 219 | for(i = 0;i < 32; ++i) | 219 | for(i = 0;i < 32; ++i) |
4937 | 220 | charClass[i] |= CTL; | 220 | charClass[i] |= CTL; |
4939 | 221 | for(i = 32;i < 256; ++i) | 221 | for(i = 32;i < 256; ++i) |
4940 | 222 | charClass[i] |= CHR; | 222 | charClass[i] |= CHR; |
4942 | 223 | for(s = (quint8*)"@ABCDGHILMPSTXZcdfry"; *s; ++s) | 223 | for(s = (quint8*)"@ABCDGHILMPSTXZcdfry"; *s; ++s) |
4943 | 224 | charClass[*s] |= CPN; | 224 | charClass[*s] |= CPN; |
4944 | 225 | // resize = \e[8;<row>;<col>t | 225 | // resize = \e[8;<row>;<col>t |
4946 | 226 | for(s = (quint8*)"t"; *s; ++s) | 226 | for(s = (quint8*)"t"; *s; ++s) |
4947 | 227 | charClass[*s] |= CPS; | 227 | charClass[*s] |= CPS; |
4949 | 228 | for(s = (quint8*)"0123456789"; *s; ++s) | 228 | for(s = (quint8*)"0123456789"; *s; ++s) |
4950 | 229 | charClass[*s] |= DIG; | 229 | charClass[*s] |= DIG; |
4952 | 230 | for(s = (quint8*)"()+*%"; *s; ++s) | 230 | for(s = (quint8*)"()+*%"; *s; ++s) |
4953 | 231 | charClass[*s] |= SCS; | 231 | charClass[*s] |= SCS; |
4955 | 232 | for(s = (quint8*)"()+*#[]%"; *s; ++s) | 232 | for(s = (quint8*)"()+*#[]%"; *s; ++s) |
4956 | 233 | charClass[*s] |= GRP; | 233 | charClass[*s] |= GRP; |
4957 | 234 | 234 | ||
4958 | 235 | resetTokenizer(); | 235 | resetTokenizer(); |
4959 | @@ -246,10 +246,10 @@ | |||
4960 | 246 | - P is the length of the token scanned so far. | 246 | - P is the length of the token scanned so far. |
4961 | 247 | - L (often P-1) is the position on which contents we base a decision. | 247 | - L (often P-1) is the position on which contents we base a decision. |
4962 | 248 | - C is a character or a group of characters (taken from 'charClass'). | 248 | - C is a character or a group of characters (taken from 'charClass'). |
4964 | 249 | 249 | ||
4965 | 250 | - 'cc' is the current character | 250 | - 'cc' is the current character |
4966 | 251 | - 's' is a pointer to the start of the token buffer | 251 | - 's' is a pointer to the start of the token buffer |
4968 | 252 | - 'p' is the current position within the token buffer | 252 | - 'p' is the current position within the token buffer |
4969 | 253 | 253 | ||
4970 | 254 | Note that they need to applied in proper order. | 254 | Note that they need to applied in proper order. |
4971 | 255 | */ | 255 | */ |
4972 | @@ -272,31 +272,31 @@ | |||
4973 | 272 | 272 | ||
4974 | 273 | // process an incoming unicode character | 273 | // process an incoming unicode character |
4975 | 274 | void Vt102Emulation::receiveChar(int cc) | 274 | void Vt102Emulation::receiveChar(int cc) |
4978 | 275 | { | 275 | { |
4979 | 276 | if (cc == 127) | 276 | if (cc == 127) |
4980 | 277 | return; //VT100: ignore. | 277 | return; //VT100: ignore. |
4981 | 278 | 278 | ||
4982 | 279 | if (ces(CTL)) | 279 | if (ces(CTL)) |
4984 | 280 | { | 280 | { |
4985 | 281 | // DEC HACK ALERT! Control Characters are allowed *within* esc sequences in VT100 | 281 | // DEC HACK ALERT! Control Characters are allowed *within* esc sequences in VT100 |
4986 | 282 | // This means, they do neither a resetTokenizer() nor a pushToToken(). Some of them, do | 282 | // This means, they do neither a resetTokenizer() nor a pushToToken(). Some of them, do |
4987 | 283 | // of course. Guess this originates from a weakly layered handling of the X-on | 283 | // of course. Guess this originates from a weakly layered handling of the X-on |
4988 | 284 | // X-off protocol, which comes really below this level. | 284 | // X-off protocol, which comes really below this level. |
4990 | 285 | if (cc == CNTL('X') || cc == CNTL('Z') || cc == ESC) | 285 | if (cc == CNTL('X') || cc == CNTL('Z') || cc == ESC) |
4991 | 286 | resetTokenizer(); //VT100: CAN or SUB | 286 | resetTokenizer(); //VT100: CAN or SUB |
4996 | 287 | if (cc != ESC) | 287 | if (cc != ESC) |
4997 | 288 | { | 288 | { |
4998 | 289 | processToken(TY_CTL(cc+'@' ),0,0); | 289 | processToken(TY_CTL(cc+'@' ),0,0); |
4999 | 290 | return; | 290 | return; |
5000 | 291 | } | 291 | } |
The diff has been truncated for viewing.
Looks good to me, thanks!
On future merge proposals, would you mind:
- Setting the commit message
- Setting the description
Have you gone through the development guide [1] and signed the contributor agreement?
Thank you!
[1] https:/ /wiki.ubuntu. com/Touch/ CoreApps/ DevelopmentGuid e