Buffer list updates preview path; cleanup

This commit is contained in:
itdominator 2024-02-16 23:26:51 -06:00
parent 9e3a7eab0b
commit 6e34078099
3 changed files with 10 additions and 11 deletions

View File

@ -26,7 +26,9 @@
<pre id="editor"></pre> <pre id="editor"></pre>
<!-- Buffers modal --> <!-- Buffers modal -->
<div class="modal" id="buffers-modal" tabindex="-1" role="dialog" data-bs-theme="dark"> <div class="modal" id="buffers-modal" tabindex="-1" role="dialog"
data-bs-theme="dark" data-bs-keyboard="false" data-bs-backdrop="static"
>
<div class="modal-dialog modal-xl" role="document"> <div class="modal-dialog modal-xl" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -47,6 +49,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<span id="preview-path" class="mx-auto"></span>
</div> </div>
</div> </div>
</div> </div>

View File

@ -94,12 +94,3 @@ document.addEventListener("keydown", (eve) => {
} }
}); });
// editor.session.selection.on('changeCursor', (eve) => {
// let ftype = aceSessions[fhash]["ftype"];
// let fpath = aceSessions[fhash]["fpath"];
// console.log(eve);
// // sendMessage("set_labels", ftype, "", fpath, "");
// });

View File

@ -76,7 +76,7 @@ const updateSession = (fhash, ftype, fname, fpath) => {
const closeSession = () => { const closeSession = () => {
let keys = Object.keys(aceSessions); let keys = Object.keys(aceSessions);
if (keys.length === 1) { if (keys.length === 1) {
const msg = "Can't close last open buffer..."; const msg = "Can't close last buffer...";
displayMessage(msg, "warning", 3); displayMessage(msg, "warning", 3);
return; return;
} }
@ -138,9 +138,12 @@ const listOpenBuffers = () => {
liElm.setAttribute("fhash", fhash); liElm.setAttribute("fhash", fhash);
if (fhash === currentSession) { if (fhash === currentSession) {
let fpath = aceSessions[fhash]["fpath"];
previewSel = liElm; previewSel = liElm;
liElm.classList.add("bg-success"); liElm.classList.add("bg-success");
liElm.classList.add("bg-info"); liElm.classList.add("bg-info");
document.getElementById("preview-path").innerText = fpath;
} }
@ -152,6 +155,7 @@ const listOpenBuffers = () => {
let fhash = eve.target.getAttribute("fhash"); let fhash = eve.target.getAttribute("fhash");
let ftype = aceSessions[fhash]["ftype"]; let ftype = aceSessions[fhash]["ftype"];
let session = aceSessions[fhash]["session"]; let session = aceSessions[fhash]["session"];
let fpath = aceSessions[fhash]["fpath"];
previewSel = eve.target; previewSel = eve.target;
previewEditor.setSession(session); previewEditor.setSession(session);
@ -160,6 +164,7 @@ const listOpenBuffers = () => {
previewEditor.session.setMode(`ace/mode/${ftype}`); previewEditor.session.setMode(`ace/mode/${ftype}`);
} }
document.getElementById("preview-path").innerText = fpath;
previewSel.classList.add("bg-info"); previewSel.classList.add("bg-info");
}) })