Skip to content

Commit c54dda0

Browse files
committed
Known-interactive-terminal detection looks at just the terminal type
Instead of looking at the full string. Prior to this patch, terminal="x11 noenhanced" would fail the known-interactive-terminal test because "x11" != "x11 noenhanced"
1 parent 7b2c5fb commit c54dda0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gnuplotlib.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,11 @@ def is_gp():
12211221
processOptions.get('terminal') == 'gp' or \
12221222
is_gp()
12231223

1224+
def is_knownInteractiveTerminal(t):
1225+
# I check the first word in the terminal string. This is the terminal type.
1226+
# Everything else is options
1227+
return t.split(maxsplit=1)[0] in knownInteractiveTerminals
1228+
12241229
def _split_dict(d, *keysets):
12251230
r'''Given a dict and some sets of keys, split into sub-dicts with keys
12261231
@@ -1293,7 +1298,7 @@ def _massageProcessOptionsAndGetCmds(processOptions):
12931298
processOptions['terminal'] = terminalOpts[outputfileType]
12941299

12951300
if processOptions.get('terminal') is not None:
1296-
if processOptions['terminal'] in knownInteractiveTerminals:
1301+
if is_knownInteractiveTerminal(processOptions['terminal']):
12971302
# known interactive terminal
12981303
if processOptions.get('output', '') != '':
12991304
sys.stderr.write("Warning: requested a known-interactive gnuplot terminal AND an output file. Is this REALLY what you want?\n")
@@ -2342,7 +2347,7 @@ def plot_process_header():
23422347
# unspecified terminal (unspecified terminal assumed to be
23432348
# interactive)? Then set the null output
23442349
if 'terminal' not in self.processOptions or \
2345-
self.processOptions['terminal'] in knownInteractiveTerminals:
2350+
is_knownInteractiveTerminal(self.processOptions['terminal']):
23462351
self._safelyWriteToPipe('set output',
23472352
'output')
23482353
else:
@@ -2403,7 +2408,7 @@ def plot_process_footer():
24032408
is_non_interactive = self.processOptions.get('output')
24042409
is_interactive = \
24052410
not self.processOptions.get('output') and \
2406-
terminal in knownInteractiveTerminals
2411+
is_knownInteractiveTerminal(terminal)
24072412

24082413
# This is certain
24092414
is_multiplot = self.processOptions.get('multiplot')

0 commit comments

Comments
 (0)