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