Skip to content
Snippets Groups Projects
Commit e462104d authored by George Nachman's avatar George Nachman
Browse files

Add off-by-default support for the REP code. Issue 6249

parent 6e6a09e3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -394,6 +394,11 @@ static void SetCSITypeAndDefaultParameters(CSIParam *param, VT100Token *result)
iTermParserSetCSIParameterIfDefault(param, 0, 1);
break;
 
case 'b': // Repeat
result->type = VT100CSI_REP;
iTermParserSetCSIParameterIfDefault(param, 0, 1);
break;
case 'B': // Cursor Down
result->type = VT100CSI_CUD;
iTermParserSetCSIParameterIfDefault(param, 0, 1);
Loading
Loading
Loading
Loading
@@ -17,6 +17,7 @@
#import "iTermPreferences.h"
#import "iTermSelection.h"
#import "iTermShellHistoryController.h"
#import "iTermTextExtractor.h"
#import "iTermTemporaryDoubleBufferedGridController.h"
#import "NSArray+iTerm.h"
#import "NSColor+iTerm.h"
Loading
Loading
@@ -4113,6 +4114,26 @@ static NSString *const kInilineFileInset = @"inset"; // NSValue of NSEdgeInsets
payload:payload];
}
 
- (void)terminalRepeatPreviousCharacter:(int)times {
if (![iTermAdvancedSettingsModel supportREPCode]) {
return;
}
if (self.cursorX == 1 && self.cursorY == 1) {
return;
}
VT100GridCoord coord = currentGrid_.cursor;
coord.y += [self numberOfScrollbackLines];
iTermTextExtractor *extractor = [[[iTermTextExtractor alloc] initWithDataSource:self] autorelease];
VT100GridCoord pred = [extractor predecessorOfCoord:coord];
if (pred.x < 0 || pred.y < 0) {
return;
}
screen_char_t c = [extractor characterAt:pred];
for (int i = 0; i < times; i++) {
[self appendScreenCharArrayAtCursor:&c length:1 shouldFree:NO];
}
}
#pragma mark - Private
 
- (VT100GridCoordRange)commandRange {
Loading
Loading
Loading
Loading
@@ -1633,6 +1633,10 @@ static const int kMaxScreenRows = 4096;
[self executeDecSetReset:token];
break;
 
case VT100CSI_REP:
[delegate_ terminalRepeatPreviousCharacter:token.csi->p[0]];
break;
// ANSI CSI
case ANSICSI_CBT:
[delegate_ terminalBackTab:token.csi->p[0]];
Loading
Loading
Loading
Loading
@@ -404,4 +404,6 @@ typedef NS_ENUM(NSUInteger, VT100AttentionRequestType) {
- (void)terminalCustomEscapeSequenceWithParameters:(NSDictionary<NSString *, NSString *> *)parameters
payload:(NSString *)payload;
 
- (void)terminalRepeatPreviousCharacter:(int)times;
@end
Loading
Loading
@@ -95,7 +95,8 @@ typedef enum {
VT100CSI_RESET_MODIFIERS, // CSI > Ps n (Set all modifiers values to -1, disabled)
VT100CSI_DECSLRM, // Set left-right margin
VT100CSI_DECRQCRA, // Request Checksum of Rectangular Area
VT100CSI_REP, // Repeat
// some xterm extensions
XTERMCC_WIN_TITLE, // Set window title
XTERMCC_ICON_TITLE,
Loading
Loading
Loading
Loading
@@ -160,6 +160,7 @@ static iTermObjectPool *gPool;
@(VT100CSI_DECDSR): @"VT100CSI_DECDSR",
@(VT100CSI_SET_MODIFIERS): @"VT100CSI_SET_MODIFIERS",
@(VT100CSI_RESET_MODIFIERS): @"VT100CSI_RESET_MODIFIERS",
@(VT100CSI_REP): @"VT100CSI_REP",
@(VT100CSI_DECSLRM): @"VT100CSI_DECSLRM",
@(XTERMCC_WIN_TITLE): @"XTERMCC_WIN_TITLE",
@(XTERMCC_ICON_TITLE): @"XTERMCC_ICON_TITLE",
Loading
Loading
Loading
Loading
@@ -197,5 +197,6 @@
+ (BOOL)sensitiveScrollWheel;
+ (BOOL)disableCustomBoxDrawing;
+ (BOOL)useExperimentalFontMetrics;
+ (BOOL)supportREPCode;
 
@end
Loading
Loading
@@ -287,5 +287,6 @@ DEFINE_BOOL(killSessionsOnLogout, NO, @"Experimental Features: Kill sessions on
DEFINE_BOOL(experimentalKeyHandling, NO, @"General: Improved support for input method editors like AquaSKK.");
 
DEFINE_BOOL(useExperimentalFontMetrics, NO, @"Experimental Features: Use a more theoretically correct technique to measure line height.\nYou must restart iTerm2 or adjust a session's font size for this change to take effect.");
DEFINE_BOOL(supportREPCode, NO, @"Experimental Features: Enable support for REP (Repeat previous character) escape sequence?");
 
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment