andreikop / enki

A text editor for programmers
http://enki-editor.org
GNU General Public License v2.0
161 stars 38 forks source link

Preview error on PHP #227

Closed yajo closed 10 years ago

yajo commented 10 years ago

A file with these contents:

<?php
$obj->attr;

Shows this preview:

attr;

But it should show nothing until <?php or <? tags are closed with ?>

panhejia commented 10 years ago

Could you tell me what your file extension is?

yajo commented 10 years ago

.php

panhejia commented 10 years ago

document.qutepart.language() identifies this file as: php (html), the isHtmlFile(document) function in preview/init.py identifies this file as a html file. If opened as a html file, this broken php file will be rendered as what you saw. Should we fix this? I think yes.

yajo commented 10 years ago

Actually PHP files are HTML except for what's inside the php tags, which can be the whole document, some parts, or nothing.

BTW, when they are mostly HTML, a preview can be useful, but when they are mostly PHP, a navigator would be more useful. I think both settings should be available.

andreikop commented 10 years ago

I don't think setting will be useful. People don't like to change settings. It is better, if software just does what user wants. If preview for PHP Might be useful, I don't want to disable it. You can just close Preview window and it will never appear again.

Now Enki pastes the code as is to QWebView. It is bad, that QWebView incorrectly renders code above. Would be cool, if somebody created PHP filter, which removes PHP tags before pasting the code to the QWebView, but, it is not highest priority now.

yajo commented 10 years ago

I don't think setting will be useful. People don't like to change settings. It is better, if software just does what user wants.

But Enki does not allow to show a navigator in PHP files.

Would be cool, if somebody created PHP filter, which removes PHP tags before pasting the code to the QWebView, but, it is not highest priority now.

Until then, the preview is quite useless. Probably defaulting for now to the navigator would be better. The preview could be default for *.phtml and *.tpl.php, which are common names for PHP templates.

andreikop commented 10 years ago

Navigator and Preview are not exclusive. Both may be shown. It seems, there is a bug. I'll try to enable Navigator for PHP

andreikop commented 10 years ago

I've enabled Navigator and disabled preview. Will see, if somebody else will complain.

yajo commented 10 years ago

Nice, thanks!