<div dir="auto"><div>It is the correct code location.</div><div dir="auto"><br></div><div dir="auto">However, calling it a bug that the documents order changes when resizing is not entirely correct. The tab bar is not a normal tab bar. Instead, it displays only as many tabs as can fit, and if there are more open documents that fit, the least recently used ones are hidden, and next to the tab bar appears a button "+5" indicating there are 5 more documents that are not in the tab bar.</div><div dir="auto"><br></div><div dir="auto">Now to the important point: if you never change the order, we would not be able to add a tab, since what tab should be removed if the tab bar is full? Right now, we hide the least recently used tab, and add the new tab on the left.</div><div dir="auto"><br></div><div dir="auto">I think these are two distinct cases:</div><div dir="auto">1. Add tab on the right, if there is still space.</div><div dir="auto">2. Add tab on the left, if there is not enough space (i.e. another tab gets hidden).</div><div dir="auto"><br></div><div dir="auto">Thoughts?</div><div dir="auto"><br></div><div dir="auto">For bugs: go to <a href="http://bugs.kde.org">bugs.kde.org</a>, use the advanced search, choose component kate, and search for tabbar or tabs:</div><div dir="auto"><br></div><div dir="auto"><a href="https://bugs.kde.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=ASSIGNED&bug_status=REOPENED&list_id=1619221&product=kate&query_format=advanced&short_desc=Tabs&short_desc_type=allwordssubstr">https://bugs.kde.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=ASSIGNED&bug_status=REOPENED&list_id=1619221&product=kate&query_format=advanced&short_desc=Tabs&short_desc_type=allwordssubstr</a><br></div><div dir="auto"><br></div><div dir="auto"><a href="https://bugs.kde.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=ASSIGNED&bug_status=REOPENED&list_id=1619222&product=kate&query_format=advanced&short_desc=Tabbar&short_desc_type=allwordssubstr">https://bugs.kde.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=ASSIGNED&bug_status=REOPENED&list_id=1619222&product=kate&query_format=advanced&short_desc=Tabbar&short_desc_type=allwordssubstr</a><br></div><div dir="auto"><br></div><div dir="auto">The bug you are looking for is:</div><div dir="auto"><a href="https://bugs.kde.org/show_bug.cgi?id=390043">https://bugs.kde.org/show_bug.cgi?id=390043</a><br></div><div dir="auto"><br></div><div dir="auto">Greetings</div><div dir="auto">Dominik</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">Andy Doucette <<a href="mailto:andy.doucette@gmail.com">andy.doucette@gmail.com</a>> schrieb am Mo., 13. Mai 2019, 04:39:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Can you point me to the bug report please? I might move this disucssion there.<div><br></div><div>I'm sifting through the code a bit. 100,000 lines is quite a lot to sift through. Thank goodness it's well commented. ;)</div><div><br></div><div>I think I've found a relevant section: </div><div>kate/kateviewspace.cpp:256</div><div> bool KateViewSpace::showView(KTextEditor::Document *document)<br></div><div><br></div><div>I think part of the reason new tabs are added on the left is that when you resize the window to be really small, and then make it bigger again, your active tab ends up moving from whatever position it was in to the left-most position. I can see why you'd always want your current tab to be visible, but I think it's a bug for the tab order to change based on this history of your window resizing. So, once that bug is addressed and we get stable tab order regardless of resizing, I think we can just change line 281 here to add at the end of the list instead.</div><div><br></div><div><span style="font-family:monospace"><span style="color:rgb(0,0,0)"></span><span style="color:rgb(24,24,178)"> 256</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,178)">bool</span><span style="color:rgb(0,0,0)"> KateViewSpace::showView(KTextEditor::Document *document)
</span><br> <span style="color:rgb(24,24,178)">257</span><span style="color:rgb(0,0,0)"> {
</span><br> <span style="color:rgb(24,24,178)">258</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,178)">const</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,178)">int</span><span style="color:rgb(0,0,0)"> index = m_lruDocList.lastIndexOf(document);
</span><br> <span style="color:rgb(24,24,178)">259</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">260</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,24)">if</span><span style="color:rgb(0,0,0)"> (index < </span><span style="color:rgb(24,24,178)">0</span><span style="color:rgb(0,0,0)">) {
</span><br> <span style="color:rgb(24,24,178)">261</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,24,178)">return</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,178)">false</span><span style="color:rgb(0,0,0)">;
</span><br> <span style="color:rgb(24,24,178)">262</span><span style="color:rgb(0,0,0)"> }
</span><br> <span style="color:rgb(24,24,178)">263</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">264</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,24)">if</span><span style="color:rgb(0,0,0)"> (! m_docToView.contains(document)) {
</span><br> <span style="color:rgb(24,24,178)">265</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,24,178)">return</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,178)">false</span><span style="color:rgb(0,0,0)">;
</span><br> <span style="color:rgb(24,24,178)">266</span><span style="color:rgb(0,0,0)"> }
</span><br> <span style="color:rgb(24,24,178)">267</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">268</span><span style="color:rgb(0,0,0)"> KTextEditor::View *kv = m_docToView[document];
</span><br> <span style="color:rgb(24,24,178)">269</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">270</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(178,178,178)">// move view to end of list</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">271</span><span style="color:rgb(0,0,0)"> m_lruDocList.removeAt(index);
</span><br> <span style="color:rgb(24,24,178)">272</span><span style="color:rgb(0,0,0)"> m_lruDocList.append(document);
</span><br> <span style="color:rgb(24,24,178)">273</span><span style="color:rgb(0,0,0)"> stack->setCurrentWidget(kv);
</span><br> <span style="color:rgb(24,24,178)">274</span><span style="color:rgb(0,0,0)"> kv->show();
</span><br> <span style="color:rgb(24,24,178)">275</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">276</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(178,178,178)">// in case a tab does not exist, add one</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">277</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,24,178)">if</span><span style="color:rgb(0,0,0)"> (! m_docToTabId.contains(document)) {
</span><br> <span style="color:rgb(24,24,178)">278</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(178,178,178)">// if space is available, add button</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">279</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,24,178)">if</span><span style="color:rgb(0,0,0)"> (m_tabBar->count() < m_tabBar->maxTabCount()) {
</span><br> <span style="color:rgb(24,24,178)">280</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(178,178,178)">// just insert</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">281</span><span style="color:rgb(0,0,0)"> insertTab(</span><span style="color:rgb(24,24,178)">0</span><span style="color:rgb(0,0,0)">, document);
</span><br> <span style="color:rgb(24,24,178)">282</span><span style="color:rgb(0,0,0)"> } </span><span style="color:rgb(24,24,178)">else</span><span style="color:rgb(0,0,0)"> {
</span><br> <span style="color:rgb(24,24,178)">283</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(178,178,178)">// remove "oldest" button and replace with new one</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">284</span><span style="color:rgb(0,0,0)"> Q_ASSERT(m_lruDocList.</span><span style="color:rgb(24,178,24)">size</span><span style="color:rgb(0,0,0)">() > m_tabBar->count());
</span><br> <span style="color:rgb(24,24,178)">285</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">286</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(178,178,178)">// we need to subtract by 1 more, as we just added ourself to the end of the lru list!</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">287</span><span style="color:rgb(0,0,0)"> KTextEditor::Document * docToHide = m_lruDocList[m_lruDocList.</span><span style="color:rgb(24,178,24)">size</span><span style="color:rgb(0,0,0)">() - m_tabBar->maxTabCount() - </span><span style="color:rgb(24,24,178)">1</span><span style="color:rgb(0,0,0)">];
</span><br> <span style="color:rgb(24,24,178)">288</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,24)">Q_ASSERT</span><span style="color:rgb(0,0,0)">(m_docToTabId.contains(docToHide));
</span><br> <span style="color:rgb(24,24,178)">289</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,24)">removeTab</span><span style="color:rgb(0,0,0)">(docToHide, </span><span style="color:rgb(24,178,178)">false</span><span style="color:rgb(0,0,0)">);
</span><br> <span style="color:rgb(24,24,178)">290</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">291</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(178,178,178)">// add new one always at the beginning</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">292</span><span style="color:rgb(0,0,0)"> insertTab(</span><span style="color:rgb(24,24,178)">0</span><span style="color:rgb(0,0,0)">, document);
</span><br> <span style="color:rgb(24,24,178)">293</span><span style="color:rgb(0,0,0)"> }
</span><br> <span style="color:rgb(24,24,178)">294</span><span style="color:rgb(0,0,0)"> }
</span><br> <span style="color:rgb(24,24,178)">295</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">296</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(178,178,178)">// follow current view</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">297</span><span style="color:rgb(0,0,0)"> Q_ASSERT(m_docToTabId.contains(document));
</span><br> <span style="color:rgb(24,24,178)">298</span><span style="color:rgb(0,0,0)"> m_tabBar->setCurrentTab(m_docToTabId.value(document, -</span><span style="color:rgb(24,24,178)">1</span><span style="color:rgb(0,0,0)">));
</span><br> <span style="color:rgb(24,24,178)">299</span><span style="color:rgb(0,0,0)">
</span><br> <span style="color:rgb(24,24,178)">300</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,24,178)">return</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(24,178,178)">true</span><span style="color:rgb(0,0,0)">;
</span><br> <span style="color:rgb(24,24,178)">301</span><span style="color:rgb(0,0,0)"> }</span><br>
<br></span></div><div><br></div><div>Do you think this is the right call? Does this course of action make sense to you? I want to make sure I'm barking up the right tree before I start editing code.</div><div><br></div><div>Cheers,</div><div>Andy</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 13, 2019 at 6:27 AM Andy Doucette <<a href="mailto:andy.doucette@gmail.com" target="_blank" rel="noreferrer">andy.doucette@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Lovely! :) I'll dive in today. The easiest change would just be to reverse it. It would take significantly more work to add a config option to reverse it. Do you think just reversing it is acceptable?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 13, 2019 at 1:02 AM Dominik Haumann <<a href="mailto:dhaumann@kde.org" target="_blank" rel="noreferrer">dhaumann@kde.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Hi Andy,</div><div dir="auto"><br></div><div dir="auto">yes, patches are accepted for sure.</div><div dir="auto">You may do a git blame to find out why a certain line of code was added. I remember I once changed this for some reason, but it seems it was not a smart change. I think we even have a bug report for it.</div><div dir="auto"><br></div><div dir="auto">Thanks</div><div dir="auto">Dominik<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">Andy Doucette <<a href="mailto:andy.doucette@gmail.com" target="_blank" rel="noreferrer">andy.doucette@gmail.com</a>> schrieb am So., 12. Mai 2019, 16:04:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello! I use kate as my main text editor for development and love it. It does _almost_ everything I need. One thing that consistently bothers me is that new tabs seem to get added on the left instead of the right. Every other system I use adds new tabs on the right. Since most of us in the west read from left to right, it makes sense to me that if I open a parent class and then open a child class and then open a grandchild class, they should be from left to right in my editor.<div><br></div><div>This bothers me to the point that I might even be willing to try and learn a new codebase to make the change. My main question is: If I submitted a pull request that swapped the order, would the "powers that be" accept it? I could probably figure out how to add a config option to make it optional even. Just would be nice to have the choice.</div><div><br></div><div>Sincerely,</div><div>Andy</div></div>
</blockquote></div></div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div></div></div>