<story><title>Vim&apos;s 400 line function to wait for keyboard input</title><url>http://geoff.greer.fm/vim/#realwaitforchar</url></story><parent_chain><item><author>joosters</author><text>But the code works. It supports lots of platforms through choice. Yes, you could make the code prettier if you dropped some platforms. Yes, you could refactor it to use some abstracting libraries that now exist. But &lt;i&gt;the code works&lt;/i&gt;. If you rewrote the code, the best result you could end up with is the same functionality that still works. All other possible results are bad. There is nothing to be gained.</text></item></parent_chain><comment><author>ggreer</author><text>I made the page as a companion piece to a blog post[1]. The code works, but it&amp;#x27;s quite buggy. Also, it is almost certainly broken on outdated OSes. It&amp;#x27;s just that nobody uses the latest Vim on IRIX or VMS, so no bug reports get filed.&lt;p&gt;A quick glance shows some obvious errors in RealWaitForChar(). For example: with typical preprocessor defines, it uses gettimeofday() in a select() loop. This will break if the system clock changes, either from user intervention or ntpd. The correct solution is to use a monotonically-increasing timer, such as Linux&amp;#x27;s clock_gettime() or OS X’s mach_absolute_time().&lt;p&gt;Vim&amp;#x27;s UI is powerful, but its codebase is a nightmare. My blog post explains why in more detail.&lt;p&gt;1. &lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;geoff.greer.fm&amp;#x2F;2015&amp;#x2F;01&amp;#x2F;15&amp;#x2F;why-neovim-is-better-than-vim&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;geoff.greer.fm&amp;#x2F;2015&amp;#x2F;01&amp;#x2F;15&amp;#x2F;why-neovim-is-better-than-v...&lt;/a&gt;</text></comment>
<story><title>Vim&apos;s 400 line function to wait for keyboard input</title><url>http://geoff.greer.fm/vim/#realwaitforchar</url></story><parent_chain><item><author>joosters</author><text>But the code works. It supports lots of platforms through choice. Yes, you could make the code prettier if you dropped some platforms. Yes, you could refactor it to use some abstracting libraries that now exist. But &lt;i&gt;the code works&lt;/i&gt;. If you rewrote the code, the best result you could end up with is the same functionality that still works. All other possible results are bad. There is nothing to be gained.</text></item></parent_chain><comment><author>chadgeidel</author><text>I am reminded of the old Joel on Software article &amp;quot;Things you should never do part 1&amp;quot;: &lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;www.joelonsoftware.com&amp;#x2F;articles&amp;#x2F;fog0000000069.html&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;www.joelonsoftware.com&amp;#x2F;articles&amp;#x2F;fog0000000069.html&lt;/a&gt;&lt;p&gt;From the article:&lt;p&gt;&amp;quot;The idea that new code is better than old is patently absurd. Old code has been used. It has been tested. Lots of bugs have been found, and they&amp;#x27;ve been fixed. There&amp;#x27;s nothing wrong with it. It doesn&amp;#x27;t acquire bugs just by sitting around on your hard drive.&amp;quot;&lt;p&gt;EDIT: Joel isn&amp;#x27;t actually recommending &amp;quot;do nothing&amp;quot; - on the contrary - the article goes into some depth on ways one can improve software without throwing everything away and starting from scratch.</text></comment>