mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-05 14:34:54 +00:00
added scrollback saving
This commit is contained in:
@@ -74,4 +74,7 @@ export abstract class Frontend {
|
||||
|
||||
abstract findNext (term: string, searchOptions?: SearchOptions): boolean
|
||||
abstract findPrevious (term: string, searchOptions?: SearchOptions): boolean
|
||||
|
||||
abstract saveState (): any
|
||||
abstract restoreState (state: any): void
|
||||
}
|
||||
|
@@ -164,6 +164,12 @@ export class HTermFrontend extends Frontend {
|
||||
return false
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
saveState (): any { }
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
restoreState (_state: any): void { }
|
||||
|
||||
private setFontSize () {
|
||||
const size = this.configuredFontSize * Math.pow(1.1, this.zoom)
|
||||
preferenceManager.set('font-size', size)
|
||||
|
@@ -5,6 +5,8 @@ import { FitAddon } from 'xterm-addon-fit'
|
||||
import { LigaturesAddon } from 'xterm-addon-ligatures'
|
||||
import { SearchAddon } from 'xterm-addon-search'
|
||||
import { WebglAddon } from 'xterm-addon-webgl'
|
||||
import { Unicode11Addon } from 'xterm-addon-unicode11'
|
||||
import { SerializeAddon } from 'xterm-addon-serialize'
|
||||
import './xterm.css'
|
||||
import deepEqual from 'deep-equal'
|
||||
import { Attributes } from 'xterm/src/common/buffer/Constants'
|
||||
@@ -30,6 +32,7 @@ export class XTermFrontend extends Frontend {
|
||||
private copyOnSelect = false
|
||||
private search = new SearchAddon()
|
||||
private fitAddon = new FitAddon()
|
||||
private serializeAddon = new SerializeAddon()
|
||||
private ligaturesAddon: LigaturesAddon
|
||||
private opened = false
|
||||
|
||||
@@ -57,7 +60,11 @@ export class XTermFrontend extends Frontend {
|
||||
this.copySelection()
|
||||
}
|
||||
})
|
||||
|
||||
this.xterm.loadAddon(this.fitAddon)
|
||||
this.xterm.loadAddon(this.serializeAddon)
|
||||
this.xterm.loadAddon(new Unicode11Addon())
|
||||
this.xterm.unicode.activeVersion = '11'
|
||||
|
||||
const keyboardEventHandler = (name: string, event: KeyboardEvent) => {
|
||||
this.hotkeysService.pushKeystroke(name, event)
|
||||
@@ -248,6 +255,14 @@ export class XTermFrontend extends Frontend {
|
||||
return this.search.findPrevious(term, searchOptions)
|
||||
}
|
||||
|
||||
saveState (): any {
|
||||
return this.serializeAddon.serialize()
|
||||
}
|
||||
|
||||
restoreState (state: any): void {
|
||||
this.xterm.write(state)
|
||||
}
|
||||
|
||||
private setFontSize () {
|
||||
const scale = Math.pow(1.1, this.zoom)
|
||||
this.xterm.setOption('fontSize', this.configuredFontSize * scale)
|
||||
|
Reference in New Issue
Block a user