allow widgets to have any height

This commit is contained in:
nightwing 2013-11-11 02:41:35 +04:00
commit 00fcd37829
2 changed files with 12 additions and 11 deletions

View file

@ -582,25 +582,24 @@ env.editor.commands.addCommand({
return; return;
} }
var rowCount = 10; var rowCount = 10;
var w = { var w = {
row: row, row: row,
rowCount: rowCount, // rowCount: rowCount,
fixedWidth: true, fixedWidth: true,
el: inlineEditor.container, el: dom.createElement("div"),
editor: editor editor: editor
}; };
var el = w.el var el = w.el;
el.appendChild(inlineEditor.container);
if (!editor.session.widgetManager) { if (!editor.session.widgetManager) {
editor.session.widgetManager = new LineWidgets(editor.session); editor.session.widgetManager = new LineWidgets(editor.session);
editor.session.widgetManager.attach(editor); editor.session.widgetManager.attach(editor);
} }
var h = rowCount*editor.renderer.layerConfig.lineHeight - 6; var h = rowCount*editor.renderer.layerConfig.lineHeight;
el.style.height = h - 4 + "px" inlineEditor.container.style.height = h + "px"
el.style.position = "absolute" el.style.position = "absolute"
el.style.zIndex = "4" el.style.zIndex = "4"

View file

@ -175,7 +175,7 @@ function LineWidgets(session) {
w.pixelHeight = w.el.offsetHeight; w.pixelHeight = w.el.offsetHeight;
} }
if (w.rowCount == null) if (w.rowCount == null)
w.rowCount = Math.ceil(w.pixelHeight / renderer.layerConfig.lineHeight); w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;
this.session._emit("changeFold", {data:{start:{row: w.row}}}); this.session._emit("changeFold", {data:{start:{row: w.row}}});
@ -221,10 +221,12 @@ function LineWidgets(session) {
w.screenWidth = Math.ceil(w.w / config.characterWidth); w.screenWidth = Math.ceil(w.w / config.characterWidth);
} }
var rowCount = Math.ceil(w.h / config.lineHeight); var rowCount = w.h / config.lineHeight;
if (w.coverLine) if (w.coverLine) {
rowCount -= this.session.getRowLineCount(w.row); rowCount -= this.session.getRowLineCount(w.row);
if (rowCount < 0)
rowCount = 0;
}
if (w.rowCount != rowCount) { if (w.rowCount != rowCount) {
w.rowCount = rowCount; w.rowCount = rowCount;
if (w.row < min) if (w.row < min)