diff --git a/src/main.tsx b/src/main.tsx index dd5a06c1..d06f8055 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -12,7 +12,7 @@ import type {SessionDataType, LineType, CmdDataType, RemoteType, RemoteStateType import type * as T from "./types"; import localizedFormat from 'dayjs/plugin/localizedFormat'; import {GlobalModel, GlobalCommandRunner, Session, Cmd, ScreenLines, Screen, riToRPtr, TabColors, RemoteColors} from "./model"; -import {windowWidthToCols, windowHeightToRows, termHeightFromRows, termWidthFromCols} from "./textmeasure"; +import {windowWidthToCols, windowHeightToRows, termHeightFromRows, termWidthFromCols, getMonoFontSize} from "./textmeasure"; import {isModKeyPress, boundInt, sortAndFilterRemotes} from "./util"; import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' @@ -116,6 +116,21 @@ class TextAreaInput extends React.Component<{onHeightChange : () => void}, {}> { } } + getTextAreaMaxCols() : number { + let taElem = this.mainInputRef.current; + if (taElem == null) { + return 0; + } + let cs = window.getComputedStyle(taElem); + let padding = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight); + let borders = parseFloat(cs.borderLeft) + parseFloat(cs.borderRight); + let contentWidth = taElem.clientWidth - padding - borders; + let fontSize = getMonoFontSize(parseInt(cs.fontSize)); + let maxCols = Math.floor(contentWidth / fontSize.width); + console.log("getareamaxcols", contentWidth, fontSize, maxCols); + return maxCols; + } + checkHeight(shouldFire : boolean) : void { let elem = this.controlRef.current; if (elem == null) { @@ -559,9 +574,10 @@ class TextAreaInput extends React.Component<{onHeightChange : () => void}, {}> { if (activeScreen != null) { activeScreen.focusType.get(); // for reaction } + let computedHeight = (displayLines*24)+14; return (
- +
); diff --git a/src/model.ts b/src/model.ts index 955089ab..47f23e37 100644 --- a/src/model.ts +++ b/src/model.ts @@ -272,7 +272,7 @@ class Screen { return null; } if (GlobalModel.isDev) { - return sprintf("http://devtest.getprompt.com:9001/static/index.html?screenid=%s&viewkey=%s", this.screenId, viewKey); + return sprintf("http://devtest.getprompt.com:9001/static/index-dev.html?screenid=%s&viewkey=%s", this.screenId, viewKey); } return sprintf("https://share.getprompt.dev/s/%s?viewkey=%s", this.screenId, viewKey); } diff --git a/src/sh2.less b/src/sh2.less index 1beac9a3..66f37e33 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -1894,6 +1894,7 @@ body .xterm .xterm-viewport { padding-bottom: calc(0.5em - 1px); padding-top: calc(0.5em - 1px); resize: none; + overflow-wrap: anywhere; &:active, &:focus { border-color: white !important; diff --git a/src/textmeasure.ts b/src/textmeasure.ts index c4397d14..6929b956 100644 --- a/src/textmeasure.ts +++ b/src/textmeasure.ts @@ -13,6 +13,7 @@ MonoFontSizes[12] = {height: 16, width: 7.203}; MonoFontSizes[13] = {height: 18, width: 7.797}; MonoFontSizes[14] = {height: 19, width: 8.398}; MonoFontSizes[15] = {height: 20, width: 9}; +MonoFontSizes[16] = {height: 22, width: 9.594}; function getMonoFontSize(fontSize : number) : {height : number, width : number} { return MonoFontSizes[fontSize];