Skip to content

Commit

Permalink
- fix the bug causing the width of xterm-screen to decrease when drag…
Browse files Browse the repository at this point in the history
…ging the resize-box vertically

- fix #79. The width of resize-box is adjusted to match that of the flex parent element when the parent is smaller than resize-box now.
- bump up the version of xterm addons
  • Loading branch information
qwefgh90 committed Dec 19, 2023
1 parent 76c658a commit bf2bb24
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 82 deletions.
8 changes: 4 additions & 4 deletions LICENSE-THIRD-PARTY
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
│ ├─ repository: https://github.com/babel/babel
│ ├─ publisher: The Babel Team
│ ├─ url: https://babel.dev/team
│ ├─ path: D:\workspace\ng-terminal\node_modules\@babel\helper-create-class-features-plugin\node_modules\@babel\helper-annotate-as-pure
│ └─ licenseFile: D:\workspace\ng-terminal\node_modules\@babel\helper-create-class-features-plugin\node_modules\@babel\helper-annotate-as-pure\LICENSE
│ ├─ path: D:\workspace\ng-terminal\node_modules\@babel\helper-remap-async-to-generator\node_modules\@babel\helper-annotate-as-pure
│ └─ licenseFile: D:\workspace\ng-terminal\node_modules\@babel\helper-remap-async-to-generator\node_modules\@babel\helper-annotate-as-pure\LICENSE
├─ @babel/[email protected]
│ ├─ licenses: MIT
│ ├─ repository: https://github.com/babel/babel
Expand Down Expand Up @@ -6144,14 +6144,14 @@
│ ├─ email: [email protected]
│ ├─ path: D:\workspace\ng-terminal\node_modules\xtend
│ └─ licenseFile: D:\workspace\ng-terminal\node_modules\xtend\LICENSE
├─ xterm-addon-fit@0.7.0
├─ xterm-addon-fit@0.8.0
│ ├─ licenses: MIT
│ ├─ repository: https://github.com/xtermjs/xterm.js
│ ├─ publisher: The xterm.js authors
│ ├─ url: https://xtermjs.org/
│ ├─ path: D:\workspace\ng-terminal\node_modules\xterm-addon-fit
│ └─ licenseFile: D:\workspace\ng-terminal\node_modules\xterm-addon-fit\LICENSE
├─ xterm-addon-web-links@0.7.0
├─ xterm-addon-web-links@0.9.0
│ ├─ licenses: MIT
│ ├─ repository: https://github.com/xtermjs/xterm.js
│ ├─ publisher: The xterm.js authors
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"xterm": "^5.1.0",
"xterm-addon-fit": "^0.7.0",
"xterm-addon-web-links": "^0.7.0",
"xterm-addon-fit": "^0.8.0",
"xterm-addon-web-links": "^0.9.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions projects/demo/src/app/example.component.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.outer-box{
height: 40vh;
overflow-y: auto;
height: 30vh;
padding: 5px 0px 5px 0px;
/* TODO: setting max-height doesn't work with ng-terminal's fit() */
/* TODO: automatically resizing following an outer box */
Expand Down
37 changes: 15 additions & 22 deletions projects/demo/src/app/example.component.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
<!-- <div>
<tabset>
<tab heading="Basic title" id="tab1">Basic content</tab>
<tab heading="Basic Title 1">Basic content 1</tab>
<tab heading="Basic Title 2">
<ng-terminal></ng-terminal>
</tab>
</tabset>
</div> -->
<mat-tab-group #tabGroup>
<mat-tab label="Terminal1">
<div class="outer-box">
<ng-terminal
#term
[dataSource]="writeSubject"
(data)="onKeyInput($event)"
[rows]="_rows"
[cols]="_cols"
[minWidth]="200"
[minHeight]="200"
[draggable]="_draggable"
class="ng-terminal"
>
</ng-terminal>
<div style="display: flex">
<div style="flex: 1">
<ng-terminal
#term
[dataSource]="writeSubject"
(data)="onKeyInput($event)"
[rows]="_rows"
[cols]="_cols"
[minWidth]="200"
[minHeight]="200"
[draggable]="_draggable"
class="ng-terminal"
>
</ng-terminal>
</div>
</div>
<div
[class.mat-elevation-z1]="true"
Expand Down
12 changes: 6 additions & 6 deletions projects/ng-terminal/src/lib/linear-render.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,20 @@ export class LinearRenderService implements OnDestroy {
}

export type PropertyChangeSet =
| { type: 'rowChanged'}
| { type: 'columnChanged'}
| { time: Date; type: 'rowChanged'}
| { time: Date; type: 'columnChanged'}
| {
type: 'dragged';
time: Date; type: 'dragged';
dragged: { draggedWidth: string; draggedHeight: string };
}
| { type: 'hostResized'; hostResized: { width: string; height: string } }
| { time: Date; type: 'hostResized'; hostResized: { width: string; height: string } }
| {
type: 'xtermViewportExceedingOuterDiv';
time: Date; type: 'xtermViewportExceedingOuterDiv';
xtermViewportExceedingOuterDiv: {
width: string;
height: string;
outerDivWidth: string;
outerDivHeight: string;
};
}
| { type: 'none' };
| { time: Date; type: 'none' };
1 change: 1 addition & 0 deletions projects/ng-terminal/src/lib/ng-terminal.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Hierarchy: parent element(user) > host element(ng-terminal) > resize-box element > outer element -->
<global-style></global-style>
<div mwlResizable #resizeBox class="resize-box" [validateResize]="validatorFactory()" [enableGhostResize]="true"
(resizeEnd)="onResizeEnd($event.rectangle.left, $event.rectangle.top, $event.rectangle.width??0, $event.rectangle.height??0)">
Expand Down
Loading

0 comments on commit bf2bb24

Please sign in to comment.