Skip to content
Snippets Groups Projects
Commit 1f5856f3 authored by aljex's avatar aljex Committed by George Nachman
Browse files

Add support for ENQ answerback string. You can set the answerback in the...

Add support for ENQ answerback string. You can set the answerback in the Terminal profiles prefs, or via applescript. ^E will cause the terminal to send the answerback string.
parent f18102cf
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -230,6 +230,9 @@
/* NSTextField (Terminal) : <title:Terminal> (oid:251) */
"Terminal" = "Terminal";
 
/* NSTextField (Answerback String) : <title:Answerback String> */
"Answerback String" = "Answerback String";
/* NSTextField (Transparency) : <title:Transparency
> (oid:172) */
"Transparency\n" = "Transparency\n";
Loading
Loading
Loading
Loading
@@ -320,6 +320,9 @@
/* NSTextField (Terminal) : <title:Terminal> (oid:1209) */
"Terminal" = "Terminal";
 
/* NSTextField (Answerback String :) : <title:Answerback String> */
"Answerback String" = "Answerback String";
/* NSBox : <title:Title> (oid:945) */
"Title" = "Title";
 
Loading
Loading
This diff is collapsed.
Loading
Loading
@@ -546,6 +546,10 @@
<cocoa key="profileName"/>
</property>
 
<property name="answerback string" code="Answ" description="ENQ Answerback string" type="text">
<cocoa key="answerBackString"/>
</property>
</class>
 
</suite>
Loading
Loading
Loading
Loading
@@ -169,6 +169,7 @@
#define KEY_SCROLLBACK_LINES @"Scrollback Lines"
#define KEY_UNLIMITED_SCROLLBACK @"Unlimited Scrollback"
#define KEY_TERMINAL_TYPE @"Terminal Type"
#define KEY_ANSWERBACK_STRING @"Answerback String"
#define KEY_USE_CANONICAL_PARSER @"Use Canonical Parser"
#define KEY_PLACE_PROMPT_AT_FIRST_COLUMN @"Place Prompt at First Column"
#define KEY_SHOW_MARK_INDICATORS @"Show Mark Indicators"
Loading
Loading
Loading
Loading
@@ -2710,6 +2710,7 @@ static NSTimeInterval kMinimumPartialLineTriggerCheckInterval = 0.5;
// extension.
[self setEncodingFromSInt32:[iTermProfilePreferences intForKey:KEY_CHARACTER_ENCODING inProfile:aDict]];
[self setTermVariable:[iTermProfilePreferences stringForKey:KEY_TERMINAL_TYPE inProfile:aDict]];
[_terminal setAnswerBackString:[iTermProfilePreferences stringForKey:KEY_ANSWERBACK_STRING inProfile:aDict]];
[self setAntiIdleCode:[iTermProfilePreferences intForKey:KEY_IDLE_CODE inProfile:aDict]];
[self setAntiIdle:[iTermProfilePreferences boolForKey:KEY_SEND_CODE_WHEN_IDLE inProfile:aDict]];
[self setAutoClose:[iTermProfilePreferences boolForKey:KEY_CLOSE_SESSIONS_ON_END inProfile:aDict]];
Loading
Loading
Loading
Loading
@@ -19,6 +19,7 @@
IBOutlet NSButton *_scrollbackInAlternateScreen;
IBOutlet NSPopUpButton *_characterEncoding;
IBOutlet NSComboBox *_terminalType;
IBOutlet NSTextField *_answerBackString;
IBOutlet NSButton *_xtermMouseReporting;
IBOutlet NSButton *_allowTitleReporting;
IBOutlet NSButton *_allowTitleSetting;
Loading
Loading
@@ -87,6 +88,10 @@
[self defineControl:_terminalType
key:KEY_TERMINAL_TYPE
type:kPreferenceInfoTypeStringTextField];
[self defineControl:_answerBackString
key:KEY_ANSWERBACK_STRING
type:kPreferenceInfoTypeStringTextField];
[self defineControl:_xtermMouseReporting
key:KEY_XTERM_MOUSE_REPORTING
Loading
Loading
Loading
Loading
@@ -49,9 +49,6 @@ static BOOL AdvanceAndEatControlChars(iTermParserContext *context,
while (iTermParserTryPeek(context, &c)) {
switch (c) {
case VT100CC_ENQ:
// TODO: This should respond with a user-definable "answerback" string, which
// defaults to the empty string.
break;
case VT100CC_BEL:
case VT100CC_BS:
case VT100CC_HT:
Loading
Loading
Loading
Loading
@@ -19,6 +19,7 @@
 
@property(nonatomic, assign) id<VT100TerminalDelegate> delegate;
@property(nonatomic, copy) NSString *termType;
@property(nonatomic, copy) NSString *answerBackString;
// The current encoding. May be changed by ISO2022_* code.
@property(nonatomic, assign) NSStringEncoding encoding;
// The "canonical" encoding, which is changed by user preference and never
Loading
Loading
Loading
Loading
@@ -31,6 +31,7 @@ NSString *const kSavedCursorOriginKey = @"Origin";
NSString *const kSavedCursorWraparoundKey = @"Wraparound";
 
NSString *const kTerminalStateTermTypeKey = @"Term Type";
NSString *const kTerminalStateAnswerBackStringKey = @"Answerback String";
NSString *const kTerminalStateStringEncodingKey = @"String Encoding";
NSString *const kTerminalStateCanonicalEncodingKey = @"Canonical String Encoding";
NSString *const kTerminalStateReportFocusKey = @"Report Focus";
Loading
Loading
@@ -226,6 +227,7 @@ static const int kMaxScreenRows = 4096;
[_output release];
[_parser release];
[_termType release];
[_answerBackString release];
 
[super dealloc];
}
Loading
Loading
@@ -269,6 +271,11 @@ static const int kMaxScreenRows = 4096;
[delegate_ terminalTypeDidChange];
}
 
- (void)setAnswerBackString:(NSString *)s {
s = [s stringByExpandingVimSpecialCharacters];
_answerBackString = [s copy];
}
- (void)setForeground24BitColor:(NSColor *)color {
graphicRendition_.fgColorCode = color.redComponent * 255.0;
graphicRendition_.fgGreen = color.greenComponent * 255.0;
Loading
Loading
@@ -1234,7 +1241,7 @@ static const int kMaxScreenRows = 4096;
 
// VT100 CC
case VT100CC_ENQ:
// TODO: Add support for an answerback string here.
[delegate_ terminalSendReport:[_answerBackString dataUsingEncoding:self.encoding]];
break;
case VT100CC_BEL:
[delegate_ terminalRingBell];
Loading
Loading
@@ -2373,6 +2380,7 @@ static const int kMaxScreenRows = 4096;
- (NSDictionary *)stateDictionary {
NSDictionary *dict =
@{ kTerminalStateTermTypeKey: self.termType ?: [NSNull null],
kTerminalStateAnswerBackStringKey: self.answerBackString ?: [NSNull null],
kTerminalStateStringEncodingKey: @(self.encoding),
kTerminalStateCanonicalEncodingKey: @(self.canonicalEncoding),
kTerminalStateReportFocusKey: @(self.reportFocus),
Loading
Loading
@@ -2408,6 +2416,12 @@ static const int kMaxScreenRows = 4096;
return;
}
self.termType = dict[kTerminalStateTermTypeKey];
self.answerBackString = dict[kTerminalStateAnswerBackStringKey];
if ([self.answerBackString isKindOfClass:[NSNull class]]) {
self.answerBackString = nil;
}
self.encoding = [dict[kTerminalStateStringEncodingKey] unsignedIntegerValue];
self.canonicalEncoding = [dict[kTerminalStateCanonicalEncodingKey] unsignedIntegerValue];
self.reportFocus = [dict[kTerminalStateReportFocusKey] boolValue];
Loading
Loading
Loading
Loading
@@ -184,6 +184,7 @@ NSString *const kProfilePreferenceInitialDirectoryAdvancedValue = @"Advanced";
KEY_SCROLLBACK_IN_ALTERNATE_SCREEN: @YES,
KEY_CHARACTER_ENCODING: @(NSUTF8StringEncoding),
KEY_TERMINAL_TYPE: @"xterm",
KEY_ANSWERBACK_STRING: @"",
KEY_XTERM_MOUSE_REPORTING: @NO,
KEY_ALLOW_TITLE_REPORTING: @NO,
KEY_ALLOW_TITLE_SETTING: @YES,
Loading
Loading
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