Skip to content

Commit e4ec6e9

Browse files
committed
Fix bug 71: wrapping of double-width characters. Fix double-click on words with double-width characters. Fix bug where key mappings are applied while cursor is in findbar.
1 parent b433f3a commit e4ec6e9

File tree

11 files changed

+735
-264
lines changed

11 files changed

+735
-264
lines changed

Headers/iTerm/VT100Screen.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
@class PTYTextView;
3737
@class iTermGrowlDelegate;
3838

39+
// This is used in the rightmost column when a double-width character would
40+
// have been split in half and was wrapped to the next line. It is nonprintable
41+
// and not selectable. It is not copied into the clipboard. A line ending in this
42+
// character should always have EOL_DWC. These are stripped when adding a line
43+
// to the scrollback buffer.
44+
#define DWC_SKIP 0xf000
45+
3946
#define TABWINDOW 300
4047

4148
@interface VT100Screen : NSObject

LineBuffer.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929

3030
#import <Cocoa/Cocoa.h>
3131

32+
// These codes go in the continuation character to the right of the
33+
// rightmost column.
34+
#define EOL_HARD 0 // Hard line break (explicit newline)
35+
#define EOL_SOFT 1 // Soft line break (a long line was wrapped)
36+
#define EOL_DWC 2 // Double-width character wrapped to next line
37+
3238
typedef struct FindContext {
3339
int absBlockNum;
3440
NSString* substring;
@@ -100,7 +106,7 @@ typedef struct screen_char_t
100106
// Try to get a line that is lineNum after the first line in this block after wrapping them to a given width.
101107
// If the line is present, return a pointer to its start and fill in *lineLength with the number of bytes in the line.
102108
// If the line is not present, decrement *lineNum by the number of lines in this block and return NULL.
103-
- (screen_char_t*) getWrappedLineWithWrapWidth: (int) width lineNum: (int*) lineNum lineLength: (int*) lineLength includesEndOfLine: (BOOL*) includesEndOfLine;
109+
- (screen_char_t*) getWrappedLineWithWrapWidth: (int) width lineNum: (int*) lineNum lineLength: (int*) lineLength includesEndOfLine: (int*) includesEndOfLine;
104110

105111
// Get the number of lines in this block at a given screen width.
106112
- (int) getNumLinesWithWrapWidth: (int) width;
@@ -145,6 +151,9 @@ typedef struct screen_char_t
145151
// Get length of last wrapped line if partial, or 0 if not partial.
146152
- (int) getTrailingWithWidth:(int)width;
147153

154+
// Return a raw line
155+
- (screen_char_t*) rawLine: (int) linenum;
156+
148157
// NSLog the contents of the block. For debugging.
149158
- (void)dump:(int)rawOffset;
150159
@end
@@ -209,13 +218,13 @@ typedef struct screen_char_t
209218
// Copy a line into the buffer. If the line is shorter than 'width' then only the first 'width'
210219
// characters will be modified.
211220
// 0 <= lineNum < numLinesWithWidth:width
212-
// Returns true if a continuation marker is needed at the end of this line.
213-
- (BOOL) copyLineToBuffer: (screen_char_t*) buffer width: (int) width lineNum: (int) lineNum;
221+
// Returns EOL code.
222+
- (int) copyLineToBuffer: (screen_char_t*) buffer width: (int) width lineNum: (int) lineNum;
214223

215224
// Copy up to width chars from the last line into *ptr. The last line will be removed or
216225
// truncated from the buffer. Sets *includesEndOfLine to true if this line should have a
217226
// continuation marker.
218-
- (BOOL) popAndCopyLastLineInto: (screen_char_t*) ptr width: (int) width includesEndOfLine: (BOOL*) includesEndOfLine;
227+
- (BOOL) popAndCopyLastLineInto: (screen_char_t*) ptr width: (int) width includesEndOfLine: (int*) includesEndOfLine;
219228

220229
// Get the number of buffer lines at a given width.
221230
- (int) numLinesWithWidth: (int) width;

0 commit comments

Comments
 (0)