1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-24 06:04:04 +03:00

set proper $TERM on Windows (fixes #91, fixes #28)

This commit is contained in:
Eugene Pankov 2017-07-10 18:26:46 +02:00
parent 6f8f83d178
commit b640abd85d
2 changed files with 14 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import * as fs from 'mz/fs' import * as fs from 'mz/fs'
import * as path from 'path' import * as path from 'path'
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService, ConfigService, HostAppService, ElectronService } from 'terminus-core' import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService, ConfigService, HostAppService, Platform, ElectronService } from 'terminus-core'
import { SessionsService } from './services/sessions.service' import { SessionsService } from './services/sessions.service'
import { ShellsService } from './services/shells.service' import { ShellsService } from './services/shells.service'
@ -14,8 +14,8 @@ export class ButtonProvider extends ToolbarButtonProvider {
private sessions: SessionsService, private sessions: SessionsService,
private config: ConfigService, private config: ConfigService,
private shells: ShellsService, private shells: ShellsService,
private hostApp: HostAppService,
electron: ElectronService, electron: ElectronService,
hostApp: HostAppService,
hotkeys: HotkeysService, hotkeys: HotkeysService,
) { ) {
super() super()
@ -51,14 +51,23 @@ export class ButtonProvider extends ToolbarButtonProvider {
cwd = await this.app.activeTab.session.getWorkingDirectory() cwd = await this.app.activeTab.session.getWorkingDirectory()
} }
let command = this.config.store.terminal.shell let command = this.config.store.terminal.shell
let args = [] let env: any = {}
let args: string[] = []
if (command === '~clink~') { if (command === '~clink~') {
({ command, args } = this.shells.getClinkOptions()) ({ command, args } = this.shells.getClinkOptions())
} }
if (command === '~default-shell~') { if (command === '~default-shell~') {
command = await this.shells.getDefaultShell() command = await this.shells.getDefaultShell()
} }
let sessionOptions = await this.sessions.prepareNewSession({ command, args, cwd }) if (this.hostApp.platform === Platform.Windows) {
env.TERM = 'cygwin'
}
let sessionOptions = await this.sessions.prepareNewSession({
command,
args,
cwd,
env,
})
this.app.openNewTab( this.app.openNewTab(
TerminalTabComponent, TerminalTabComponent,
{ sessionOptions } { sessionOptions }

View File

@ -25,8 +25,8 @@ export class Session {
let env = { let env = {
...process.env, ...process.env,
...options.env,
TERM: 'xterm-256color', TERM: 'xterm-256color',
...options.env,
} }
if (process.platform === 'darwin' && !process.env.LC_ALL) { if (process.platform === 'darwin' && !process.env.LC_ALL) {