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;
}
var rowCount = 10;
var w = {
row: row,
rowCount: rowCount,
// rowCount: rowCount,
fixedWidth: true,
el: inlineEditor.container,
el: dom.createElement("div"),
editor: editor
};
var el = w.el
var el = w.el;
el.appendChild(inlineEditor.container);
if (!editor.session.widgetManager) {
editor.session.widgetManager = new LineWidgets(editor.session);
editor.session.widgetManager.attach(editor);
}
var h = rowCount*editor.renderer.layerConfig.lineHeight - 6;
el.style.height = h - 4 + "px"
var h = rowCount*editor.renderer.layerConfig.lineHeight;
inlineEditor.container.style.height = h + "px"
el.style.position = "absolute"
el.style.zIndex = "4"

View file

@ -175,7 +175,7 @@ function LineWidgets(session) {
w.pixelHeight = w.el.offsetHeight;
}
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}}});
@ -221,10 +221,12 @@ function LineWidgets(session) {
w.screenWidth = Math.ceil(w.w / config.characterWidth);
}
var rowCount = Math.ceil(w.h / config.lineHeight);
if (w.coverLine)
var rowCount = w.h / config.lineHeight;
if (w.coverLine) {
rowCount -= this.session.getRowLineCount(w.row);
if (rowCount < 0)
rowCount = 0;
}
if (w.rowCount != rowCount) {
w.rowCount = rowCount;
if (w.row < min)